Search code examples
batch-filecolorscommand-prompt

Trying to open a new cmd window then run multiple commands in it


I am facing a rather annoying issue when trying to write a batchscript file for my assignment, the assignment asks me to open a new command prompt window, change its color and make it print the current windows version. I can make it open the new window and change the color but no matter what I do it will always execute any new commands including the ver command on the old command prompt window, I have tried using & to run multiple commands but it just does nothing.

start cmd /k color F1 & ver
pause

This is the code I have now, any help would be appreciated


Solution

  • To undertake the task you've specifically shown us, there is no need whatsoever to use the color command, and as a result, include an ampersand to join two commands.

    If you open a Command Prompt window, type cmd.exe /? and press the ENTER key, you should see that there is a /T option you can use.

    Start %SystemRoot%\System32\cmd.exe /T:F1 /D /K Ver