nemadedurgesh
New Member
- Joined
- Dec 2, 2016
- Messages
- 5
Macro for executing commands from cmd prompt
I need to run a batch from command prompt. It has exe file as well. My moto is to activate exe as schedule run. Below are the problem which I am facing due to which I need a macro to be created. Any of the resolution can solve my problem.
This batch works fine when I directly double click on exe and start it. Also is works fine when manually trigger from command prompt.
Brief idea of Batch - When I double click on batch exe, one csv file is created at given location, ertract all information in string from application and save it in created csv file.
I have tried below three approach and issue is that batch is triggered but csv file if not triggered at the start which causes to fail this batch
approach 1 - when I call exe file by "schedule task"
approach 2 - When I call exe file from macro without using cmd
approach 3 - when I call exe file using macro with cmd
Below is the code I have created. Please suggest
Sub Workbook_Open()
Call Shell("cmd.exe /S /K" & "E:\Users\x9nemd\Desktop\R2_Utility\TfsDataExport.exe", vbNormalFocus)
MsgBox ("Extract Run Activated")
End Sub
I need to run a batch from command prompt. It has exe file as well. My moto is to activate exe as schedule run. Below are the problem which I am facing due to which I need a macro to be created. Any of the resolution can solve my problem.
This batch works fine when I directly double click on exe and start it. Also is works fine when manually trigger from command prompt.
Brief idea of Batch - When I double click on batch exe, one csv file is created at given location, ertract all information in string from application and save it in created csv file.
I have tried below three approach and issue is that batch is triggered but csv file if not triggered at the start which causes to fail this batch
approach 1 - when I call exe file by "schedule task"
approach 2 - When I call exe file from macro without using cmd
approach 3 - when I call exe file using macro with cmd
Below is the code I have created. Please suggest
Sub Workbook_Open()
Call Shell("cmd.exe /S /K" & "E:\Users\x9nemd\Desktop\R2_Utility\TfsDataExport.exe", vbNormalFocus)
MsgBox ("Extract Run Activated")
End Sub