Reputation: 5877
I would like to from my current command prompt open another command prompt and cd to a directory of my choice. I am currently doing the following:
start cmd /c "cd C:\Users"
I expect this to open a new command prompt and cd to that directory. I also expect it to show that cd command in the new command prompt. None of this is happening, only a brief second command window opening and closing out. What am I doing wrong here?
Upvotes: 1
Views: 221
Reputation:
Instead of using pause
, do cmd /k
.
Flag c
loses the cmd window.
Flag k
eeps the cmd window opens
So, your code should be:
start "windowTitle" cmd /k "cd C:\Users"
Upvotes: 2
Reputation: 1585
On the line below include "pause" This will keep the window open promoting a key press. Keeping the cmd window open allows you to check it has done what you have asked. Cmd windows self terminate once all code has complete.
Upvotes: 1