I have a shortcut on my desktop which opens a command prompt with many arguments that I need. I set the 'start in' field to d:\ and it works as expected (the prompt starts in d:). When I choose Advanced -> run as administrator and then open the shortcut, it starts in C:\Windows\System32, even though I have not changed the 'start in' field. How can I get it to start in d:\?
views:
1642answers:
1
+2
A:
If you use the /k argument, you can add a single line to execute a change drive and change directory. For instance:
C:\Windows\System32\cmd.exe /k "d: & cd d:\storage"
Using &
you can string together many commands on one line.
Edit: You can also change drive with the cd command alone "cd /d d:\storage"
. Thanks to Adam Mitz for the comment.
Joseph Daigle
2008-09-16 01:20:22
why not just use one command? cd /d d:\storage
Adam Mitz
2008-09-16 01:27:05
I did not know the change directory command did that. Good to know.
Joseph Daigle
2008-09-16 01:29:59
Yep... there's a surprising amount to learn in cmd.exe.
Adam Mitz
2008-09-16 02:16:43