In your batch file, use the following:
start cmd.exe /k "more-batch-commands-here"
or
start cmd.exe /c "more-batch-commands-here"
/ c Executes the command specified by the line and then ends
/ k Executes the command given by the string, but remains
See the cmd.exe documentation for more information using cmd /? .
Correct formatting of the command line is a little complicated by spaces in the arguments. See Examples below. Note the use of nested double quotes in some examples.
Examples:
Run the program and pass the file name parameter:
CMD /c write.exe c:\docs\sample.txt
Run the program and skip the long file name:
CMD /c write.exe "c:\sample documents\sample.txt"
Spaces in the program path:
CMD /c ""c:\Program Files\Microsoft Office\Office\Winword.exe""
Spaces in the program path + parameters:
CMD /c ""c:\Program Files\demo.cmd"" Parameter1 Param2
CMD /k ""c:\batch files\demo.cmd" "Parameter 1 with space" "Parameter2 with space""
Run demo1 and demo2:
CMD /c ""c:\Program Files\demo1.cmd" & "c:\Program Files\demo2.cmd""
Source: http://ss64.com/nt/cmd.html
Shannon Feb 09 '15 at 23:33 2015-02-09 23:33
source share