I am opening 3 cmd windows in different colours to help me distinguish between servers etc. These commands are in a .bat
file.
start cmd /k color 4C
start cmd /k color 5D
start cmd /k color 2A
What I need to do is have them open up at a specific location but I can't seem to get it to chain commands.
How can I cd
in to some folder structure immediately after starting a cmd window?
Use &
:
start cmd /k "color 4C & cd \"
You have to quote the commands now, otherwise the &
is consumed by the outer command prompt (e.g. the one running the batch file) rather than the newly launched one.
You also have another option - so far as I'm aware, a newly launched command prompt inherits the same current directory as the command prompt that launches it. So you could change your batch file to:
cd \location1
start cmd /k color 4C
cd \location2
start cmd /k color 5D
cd \location3
start cmd /k color 2A
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With