1.    25 Sep 2015 #1
    Join Date : Apr 2014
    Space coast of Florida
    Posts : 5,251
    Windows 10 Pro X64 15063.483

    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.    25 Sep 2015 #2
    Join Date : Jul 2014
    San Jose, California
    Posts : 2,057
    Ubuntu14.04x64 MintMate17x64 Win10Prox64

    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:	44 
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.    25 Sep 2015 #3
    Join Date : Apr 2014
    Space coast of Florida
    Posts : 5,251
    Windows 10 Pro X64 15063.483
    Thread Starter

    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.    25 Sep 2015 #4
    Join Date : Jul 2014
    San Jose, California
    Posts : 2,057
    Ubuntu14.04x64 MintMate17x64 Win10Prox64

    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.    25 Sep 2015 #5
    Join Date : Oct 2013
    Posts : 24,410
    64-bit Windows 10 Pro build 17017
      My ComputersSystem Spec
  6.    26 Sep 2015 #6
    Join Date : Apr 2014
    Space coast of Florida
    Posts : 5,251
    Windows 10 Pro X64 15063.483
    Thread Starter

    Quote Originally Posted by topgundcp 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.    26 Sep 2015 #7
    Join Date : Apr 2014
    Space coast of Florida
    Posts : 5,251
    Windows 10 Pro X64 15063.483
    Thread Starter

    Quote Originally Posted by Brink View Post
    I had one similar but it was not an Admin Command Prompt.. I like this one better.

    Thanks Shawn.
      My ComputersSystem Spec
  8.    26 Sep 2015 #8
    Join Date : Oct 2013
    Posts : 24,410
    64-bit Windows 10 Pro build 17017

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

 


Similar Threads
Thread Forum
General Tips Open Elevated Command Prompt in Windows 10
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...
Tutorials
General Tips Open Command Prompt in Windows 10
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...
Tutorials
General Tips Open Command Prompt at Boot in Windows 10
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...
Tutorials
Solved Command Prompt
How to call up "command Prompt (Admin) from the "run" dialog box win 10 Home?
General Support
Command Prompt?
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...
General Support
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 05:07.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums