Admin CMD showing up as C:\Windows\system32> instead of C:\user\NAME>


  1. wry
    Posts : 1
    Windows 10
       #1

    Admin CMD showing up as C:\Windows\system32> instead of C:\user\NAME>


    I need a way to make it so that instead of having C:\Windows\system32> there will be C:\user\NAME> when I open the command prompt. When I run cmd as a regular user it comes up with C:\user\NAME> but when I run as an administrator it comes up with C:\Windows\system32> Please let me know if there is a fix as I need there to be administrative privilege's to install a program.
      My Computer


  2. Posts : 23,186
    Win 10 Home ♦♦♦19045.4291 (x64) [22H2]
       #2

    Hello @wry ...Welcome to Ten Forums.

    You just use the cd (change directory) command.


    Admin CMD showing up as C:\Windows\system32> instead of C:\user\NAME>-image1.png




    In your case you would use cd c:\users\ (your user name)
      My Computer


  3. Posts : 4,780
    Windows 11 Pro 64 Bit 22H2
       #3

    By default, the Command Prompt as Admin is run from C:\Windows\System32. If it is run from the User Name, then it is not run in Admin mode. Why do you need it to be run from your User folder?
      My Computer


  4. Posts : 456
    Windows 10
       #4

    1. Open the registry on this path:

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor
    2. Create or modify a string value called "Autorun" and change its data to:

    cd %userprofile%
    Now the command prompt will always open in your userprofile doesn't matter if you run it as normal user or admin.

      My Computer


  5. Posts : 16,927
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #5

    Ricardo,

    Thanks for that. I had not seen a method setting the cmd opening path in the Registry before. It's much neater than my customised shortcut method.

    Setting my Desktop for the Admin Cmd window involves a change of disk as well so, to stick with your example, I adjusted the entry to
    Code:
    cd /d %userprofile%
    but I think that will only be of interest to those like me who have relocated user folders and they might use, for example only,
    Code:
    cd /d D:\Desktop


    All the best,
    Denis
      My Computer


  6. Posts : 456
    Windows 10
       #6

    A side note is that some batch files that use relative paths may have some unexpected behavior. For example a batch that creates a new folder called "Dog" in it's current folder.

    md Dog

    That folder may be created in the folder you directed in "Autorun" instead of the folder where the batch script is.
      My Computer


  7. Posts : 17,661
    Windows 10 Pro
       #7

    Ghot said:
    In your case you would use cd c:\users\ (your user name)
    ... or simply cd %userprofile%

    Admin CMD showing up as C:\Windows\system32> instead of C:\user\NAME>-image.png

    Kari
    Last edited by Kari; 05 Jun 2021 at 15:07. Reason: Added screenshot
      My Computer


  8. Posts : 23,186
    Win 10 Home ♦♦♦19045.4291 (x64) [22H2]
       #8

    Kari said:
    ... or simply cd %userprofile%

    Kari

    I'm sure the OP appreciates the help.
      My Computer


 

  Related Discussions
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 07:41.
Find Us




Windows 10 Forums