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
CodePudding user response:
Have you tried
start "My assignment" cmd /k "color F1 & ver"
Note that the window title is the first quoted string in the start
command.
CodePudding user response:
Without double quotes only the "color f1" command is being passed to your new cmd window.
start cmd /k "color F1 & ver"
pause
I think will give you the results you want.
CodePudding user response:
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