3

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?

  • 1
    add a "pause" line to make the window stay open and wait for input from you. The error, if any, is likely your best hint right now – panhandel Nov 17 '15 at 17:34
1

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.)

0

Any ideas on where I am going wrong?

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

Your start command is wrong.

The first argument should be the title of the command (it is not optional).

Try:

START "my command title" "C:\Users\delta\dc2.exe" -configure=C:\Users\delta\Switch.xml

or

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

Syntax

START "title" [/D path] [options] "command" [parameters]

Key:

title       Text for the CMD window title bar (required.)
path        Starting directory.
command     The command, batch file or executable program to run.
parameters  The parameters passed to the command.

...

Always include a TITLE this can be a simple string like "My Script" or just a pair of empty quotes ""

According to the Microsoft documentation, the title is optional, but depending on the other options chosen you can have problems if it is omitted.


Further Reading

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.