Windows – Executing a command line command from a simple batch file

batch filecommand linewindows

I am very new to this so a simplified explanation would be appreciated.

I am trying to make a batch file that executes the following command in the command prompt:

C:\Users\delta\dc2.exe -configure="C:\Users\delta\Switch.xml"

So far i have tried putting the follwing in a .bat but i have had no luck:

START cmd.exe /k "C:\Users\delta\dc2.exe -configure="C:\Users\delta\Switch.xml""

I simply get the command prompt popping up for a fraction of a second and then it disappears. (Can't read what it says)

Any ideas on where i am going wrong?

Best Answer

You probably don't need to be using the START command. The reason I typically find the START command may be quite useful is for running a program in the background, which may not be the desired action if you're trying to see results. Just make a new text file that says:

@Echo Off
C:\Users\delta\dc2.exe -configure="C:\Users\delta\Switch.xml"
pause

Make sure that the filename ends with ".bat", e.g. "rundc2.bat"
Then, from the command line, run: "rundc2"
(The ".bat" is optional, when you're running the program.)

Related Question