I already know how to create a new cmd window from a batch script with custom color, and a new cmd window with a custom prompt. However am wanting to find a way of combining the two together...
Here is what I have in my batch file to create a new cmd window with customised prompt (in this case, the customised prompt is the windows version details):
start cmd /k "prompt $v"
... And this is what I'm doing to create a new cmd window with customised color:
start cmd /k "color 42"
I've tried the following to combine the two, but none of them work:
start cmd /k "color 42" /k "prompt $v"
start cmd /k"color 42" "prompt $v"
If anyone can help point me in the right direction that would be awesome. Been searching via Google and other forums but after spending over an hour on a fruitless search I thought I'd ask a question here...
The only thing you are missing is the operator that will concatenate multiple commands on one line:
&
.This operator works in all situations, not just within the command string for the CMD command. There are a few concatenation operators with different behavior:
&
- Always executes the next command&&
- Only executes the next command if the prior command was successful (ERRORLEVEL=0)||
- Only executes the next command if the prior command failed (ERRORLEVEL<>0)try: