How can I make a shortcut start in a different directory when running it as an administrator on Windows Vista?

StackOverflow https://stackoverflow.com/questions/68307

Question

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:\?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top