I'm using start
to run a command from a batch file.
SET mycmd=SOME_CMD WITH ARGS
START "Demo" %mycmd%
This works fine, and the resulting cmd window persists after executing the contents of mycmd
, even if the batch file was double-clicked - the reason why I'm using start
to begin with.
However I would also like to print something in the new cmd window that start
opens, before it runs the command.
I'd imagine that I would pass start an echo command, followed by the command I want it to run.
My first naive approach was as follows:
SET mycmd=SOME_CMD WITH ARGS
START "Demo" ECHO Running Command... && %mycmd%
Of course this does not work; start
opens a new window which only runs the echo
command, and the command after the &&
divider is run in the original window, not in the new one that the echo
ran in.
Basically it performs (start echo) && (my_cmd)
instead of start (echo && my_cmd)
- parentheses added for clarity, not any actual syntactic meaning
So my question is: Is there a way to pass two commands to start
at once? Specifically, I really just want it to echo
out some content, and then run a command.