Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

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"
share|improve this answer
    
This is exactly what I was hoping for. Thanks! –  Adam Lewis Mar 22 '12 at 3:50
1  
You may use single command: C:\Windows\System32\cmd.exe /k "cd /d G:\Users\Adam\Work" –  Maximus Aug 13 '12 at 23:07

Use ..

cmd.exe /s /k pushd \"%V\"

where %V is the full UNC to the target partition/folder.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.