Windows 7 – Run CMD.exe as Admin and Start in a Different Partition

administratorcommand linewindows 7

There are many questions on running CMD.exe as admin on Windows 7, however none of them appear to include a different "Start In" directory / partition.

  • I can start a command prompt in a different partition by setting the "Start In:" field in the short cut properties. (ie G:\Users\Adam\Work)

  • I can run the command prompt as Admin by any of the conventional methods: ctrl+alt+e, changing the short cut Advanced tab to run as admin, etc…

  • I can NOT do them at the same time… Setting the Start In field to G:\Users\Adam\Work and attempting to run the short cut as Admin causes a Network Error (see below)

My Current workaround to is to remove the Start In field (it then starts in C:Windows\System32) and cd into my other partition (G:\Users\Adam\Work) and type "G:" to switch drives. Opening many cmd windows, to do SW development has become extremely annoying. Is there a better solution than this (other than installing an external shell)?

Network Error
Windows cannot access C:\Windows\System32\cmd.exe
Check the spelling of the name. Otherwise, there might be a problem with your network.

Best Answer

Yes. Use the /k option to run commands at launch and keep the window open. For your example, create a shortcut with the following target:

C:\Windows\System32\cmd.exe /k "G: & cd Users\Adam\Work"
Related Question