Windows start command cannot execute batch file

I run the start command from the command line. The command calls a batch file named D: \ My script.cmd and passes the argument to Argument . Here is the command that I am executing.

C:\Users\ABCUser>start "D:\My script.cmd" "Argument one" 

but getting mesasge errors as the system cannot find the file argument one. I do not understand why the command is looking for a file. The contents of the file My script.cmd.

 @echo off cls echo "Hello" echo %1 

Am I missing something or is the command syntax wrong? This command does not even work for a file name without spaces.

+3
windows cmd batch-file
source share
2 answers

This is the well-known start / cmd.exe error handling cmd, as well as the quoted argument.
The reason is that start uses cmd.exe / k to start a new task.
The help of cmd / k and cmd / c explains that in this case the first and last quotes are deleted.

In addition, you used the start command incorrectly.

This should work as the call works like a dummy to suppress the citation problem

 start "Title" call "D:\My script.cmd" "Argument one" 
+5
source share

You can use cmd.exe /c "D:\My script.cmd" arg1 arg2

If there is a problem, you can switch / c with / k to leave CMD open for you to check for errors.

G.L.,

Refael

+1
source share

All Articles