How Do I Pass Multiple Commands to Start in Windows Command Line?

How do I pass multiple commands to start?

I tried

start "window title" echo 1 && echo 2

But, predictably, start only gets "echo 1" and thus "1" is echoed in the new window, and "2" is echoed in the first window.

Is there some way to "escape" the && operator, or another way to pass multiple commands into start so they run successively in the new window?

2

2 Answers

How do I pass multiple commands to start?

You need to use the cmd /k option and also quote the command you are running.

The following command will work:

start "window title" cmd /k "echo 1 && echo 2"

where:

Options   
   /C     Run Command and then terminate

   /K     Run Command and then return to the CMD prompt.
          This is useful for testing, to examine variables

   Command : The command, program or batch script to be run.
             This can even be several commands separated with '&' 
             (the whole should also be surrounded by "quotes")

Source: CMD.exe (Command Shell) - Windows CMD - SS64.com


Further Reading

5

Another method is to escape the & with ^.

start "window title" echo 1 ^&^& echo 2
2

Your Answer

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

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest