Windows 10: Get elevated command prompt to open in my user directory Solved


  1. Posts : 5,011
    Windows 10 Pro X64 15063.138
       25 Sep 2015 #1

    Get elevated command prompt to open in my user directory


    I changed Command Prompt on my Taskbar so when I click on it, it opens as Administrator.
    That sets the default directory as C:\WINDOWS\system32 which I don't like, since any files I create that do not have a path specified will be created there.

    I want it to open in my user directory.

    When I look at the properties I see Start in: %homedrive%%homepath% which converts to C:\Users\myaccountname yet when I launch the Command Prompt it still goes to C:\WINDOWS\system32.

    Click image for larger version. 

Name:	CMDPro1.jpg 
Views:	2 
Size:	56.9 KB 
ID:	39451

    Any ideas how to make this work?
      My ComputersSystem Spec


  2. Posts : 2,033
    Ubuntu14.04x64 MintMate17x64 Win10Prox64
       25 Sep 2015 #2

    Create a shortcut with:
    C:\Windows\system32\cmd.exe /K cd %USERPROFILE%
    and set to run as Admin
    OR use the below for any folder


    Copy and paste the following in a .reg file then merge to the registry. This will add to right click context menu
    Right click ->Open Admin Command here will open the command default to the current folder where the mouse is pointing at. This is more flexible than just your user folder.

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
    @="Admin Command Here"
    "NoWorkingDirectory"=""
    "HasLUAShield"=""
    "Position"="Top"

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

    Click image for larger version. 

Name:	a.jpg 
Views:	43 
Size:	48.5 KB 
ID:	39452
    Last edited by topgundcp; 25 Sep 2015 at 19:19. Reason: Typo. added "" to the end
      My ComputerSystem Spec


  3. Posts : 5,011
    Windows 10 Pro X64 15063.138
    Thread Starter
       25 Sep 2015 #3

    The last part seems to be wrong, extra double quote at end.

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

    I changed it to

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

    and it works, but opens to my Desktop directory. I'd like to backup one level to my user directory but this is useable, thanks.

    I would still like to be able to modify the Command Prompt.
      My ComputersSystem Spec


  4. Posts : 2,033
    Ubuntu14.04x64 MintMate17x64 Win10Prox64
       25 Sep 2015 #4

    and it works, but opens to my Desktop directory. I'd like to backup one level to my user directory but this is useable, thanks.

    I would still like to be able to modify the Command Prompt.
    Right click context menu is more flexible. If your file explorer is currently pointing at your USER then it will open as C:\Users\Rich

    I edited for the user above:
    Create a shortcut with:
    C:\Windows\system32\cmd.exe /K cd %USERPROFILE%
    and set to run as Admin
    Get elevated command prompt to open in my user directory Attached Files
    Last edited by topgundcp; 25 Sep 2015 at 19:43.
      My ComputerSystem Spec


  5. Posts : 20,840
    64-bit Windows 10 Pro build 16199
       25 Sep 2015 #5
      My ComputersSystem Spec


  6. Posts : 5,011
    Windows 10 Pro X64 15063.138
    Thread Starter
       26 Sep 2015 #6

    topgundcp said: View Post
    Right click context menu is more flexible. If your file explorer is currently pointing at your USER then it will open as C:\Users\Rich

    I edited for the user above:
    Create a shortcut with:
    C:\Windows\system32\cmd.exe /K cd %USERPROFILE%
    and set to run as Admin
    Perfect!!! Thanks (also thanks on eightforums )
      My ComputersSystem Spec


  7. Posts : 5,011
    Windows 10 Pro X64 15063.138
    Thread Starter
       26 Sep 2015 #7

    I had one similar but it was not an Admin Command Prompt.. I like this one better.

    Thanks Shawn.
      My ComputersSystem Spec


  8. Posts : 20,840
    64-bit Windows 10 Pro build 16199
       26 Sep 2015 #8

    You're welcome Rich. Glad it could help.
      My ComputersSystem Spec


 

Related Threads
How to Open an Elevated Command Prompt in Windows 10 A command prompt is an entry point for typing computer commands in the Command Prompt window. By typing commands in an elevated command prompt, you can perform tasks that require...
General Tips Open Command Prompt in Windows 10 in Tutorials
How to Open a Command Prompt in Windows 10 A command prompt is an entry point for typing computer commands in the Command Prompt window. By typing commands at the command prompt, you can perform tasks on your computer without using the Windows...
How to Open a Command Prompt at Boot in Windows 10 A command prompt is an entry point for typing computer commands in the Command Prompt window. By typing commands at the command prompt, you can perform tasks on your computer without using the...
Solved Command Prompt in General Support
How to call up "command Prompt (Admin) from the "run" dialog box win 10 Home?
Command Prompt? in General Support
Guys, I'm going to try one last time. The error code I received told to me to empty files and then "Run the command prompt as an administrator"?? Then, type wuauclt.exe/update now??......I don't know what run the command prompt means. I have no...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 20:13.
Find Us