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.

So, I know you can create a shortcut to an administrator-level command prompt (as described in this question), but what I'm seeing is that whenever I use such a shortcut, it always drops me into c:\windows\system32\ path.

I've tried specifying that shortcut's properties to set the "start in" path I need, but to no avail. It seems any time I run cmd.exe "As Administrator," it completely disregards the shortcut's paths and sticks to c:\windows\system32\

Any suggestions on how to get Windows 7 to respect the shortcut's "start in" path?

share|improve this question

6 Answers 6

up vote 13 down vote accepted

I found a way around this. In the shortcut, change the command line to:

C:\Windows\System32\cmd.exe /k "cd c:\"

In this case it changes the starting directory to the root of C:. You can set your own parameters.

share|improve this answer
    
Excellent, Peter. Thanks! –  Alex Beynenson Jun 24 '10 at 11:10
    
Great answer, Thanks! –  fwaokda Feb 9 '13 at 23:00
    
Great answer! Helped me out alot! –  wefsdgdfgdfsg Jul 25 at 21:30

Launch an elevated Command Prompt from the context menu

To add the Open Command Window Here (Administrator) option to the context menu for file system folders, use the following REG file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open Command Window Here (Administrator)"

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

To add the entry to Computer (My Computer) context menu, use the following REG file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\runas]
@="Open Command Prompt (Administrator)"

[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\runas\command]
@="cmd.exe"

Usage

Copy the above contents to Notepad, and save the file with .REG extension. Then right-click the REG file and choose Merge.

Source

share|improve this answer
    
This is a good suggestion, but not quite what I'm looking for. I'm looking for a way to create an arbitrary shortcut, which I can pin to the taskbar. –  Alex Beynenson Dec 28 '09 at 2:39
    
i'm not sure if this is possible, unless you change the start directory for CMD globally: To change default path where cmd starts add/edit REG_SZ Autorun in HKEY_CURRENT_USER\Software\Microsoft\Command Processor replacing the Value Data with a folder or directory preceded by a CD\ –  Molly7244 Dec 28 '09 at 3:12
    
Thanks for this suggestion. It's a decent workaround. –  Alex Beynenson Dec 28 '09 at 13:22

You can right click CMD, select Properties and in the "Start in" box clear whatever is there, entering: %SystemRoot%\system32. Click OK.

share|improve this answer

It will happen if the place where you want to open your command prompt is on a different drive than the shortcut is. The solution is to put an additional command in the shortcut:

C:\Windows\System32\cmd.exe /k "a: & cd a:\something"

In this case it will change to the drive a: from the current drive, and than open the a:\something folder. The & operator is used to put multiple commands in a single line at the windows command prompt.

share|improve this answer
1  
cd /d a:\something will change to a different drive and directory –  Luke Jan 9 '13 at 23:32

This is what I do:

First I create a shortcut for cmd.exe and place it into a directory that I will always keep from computer to computer.. e.g. c:\PersonalData\Windows Customize\Admin then I edit the shortcut to read as below (Domain and AdminUser you will need to change)

C:\Windows\System32\runas.exe /user:domain\AdminUser /savecred "C:\Windows\System32\cmd.exe /k cd c:\PersonalData"

Then I create a toolbar on my taskbar that points to the "Admin" Folder.. this is where I keep all my admin tools ... this works on WinXP and Windows 7..

Another thing that I will do is change the color of my background of this cmd prompt that easily identifies that I have my admin credentials open... if you want to be more secure take out the /savecred then it will prompt you for your admin password every time

share|improve this answer

"You can right click CMD, select Properties and in the "Start in" box clear whatever is there, entering: %SystemRoot%\system32. Click OK."

I used this solution in Windows 7, but Windows 8 doesn't allow it. :(

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.