Open cmd from file explorer with admin rights


  1. Posts : 1
    Windows 10 Pro x64
       #1

    Open cmd from file explorer with admin rights


    I managed to get cmd to always run as admin from start->cmd

    But running cmd this way always launch it at the windows/system32 directory.

    I need a way to run cmd in file explorer directly so that the current directory will be at the path I launched it but it is always launching without the admin rights.
      My Computer


  2. Posts : 2,799
    Linux Mint 20.1 Win10Prox64
       #2

    Easiest way is to have it run from right click context menu. Copy and paste the code and save it as .reg file. Double click on the file to merge to the registry. Right click anywhere on desktop/file explorer, select "Admin Command Here":
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
    @="Admin Command Here"
    "NoWorkingDirectory"=""
    "HasLUAShield"=""
    "Position"="Top"
    "Icon"="C:\\Windows\\System32\\cmd.exe"
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
    @="cmd.exe /s /k pushd \"%V\""
    Open cmd from file explorer with admin rights-.jpg
      My Computer


  3. Posts : 9,785
    Mac OS Catalina
       #3

    You have to open File Explorer, go to the directory that you want it to run in, then right click and run Command in that directory. The only time that you want to open Command in a particular directory, is if you are going to run say Powercfg and need the report from it placed into that directory.
      My Computer


  4. Posts : 27
    Windows 10
       #4

    KyoSuke said:
    I managed to get cmd to always run as admin from start->cmd

    But running cmd this way always launch it at the windows/system32 directory.

    I need a way to run cmd in file explorer directly so that the current directory will be at the path I launched it but it is always launching without the admin rights.
    Please check out this tutorial:
    https://www.tenforums.com/tutorials/2...dows-10-a.html

    "Option 7" should be what you're looking for.
    Last edited by Brink; 22 Sep 2016 at 09:47. Reason: link
      My Computer


  5. Posts : 68,868
    64-bit Windows 11 Pro for Workstations
       #5

    Hello KyoSuke, and welcome to Ten Forums. :)

    If you like, the tutorial below can help you to easily add this option to your context menu.

    Open command window here as administrator - Add in Windows 10
      My Computers


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

    You can add the necessary command to the File explorer Quick access toolbar [without doing any Registry edits or using any additional utilities].

    In File explorer,
    click on File ,
    hover over Open command prompt,
    right click on Open command prompt as administrator,
    select Add to Quick access toolbar.

    The facility will then always be readily available to you on the QAT so you can get an Admin prompt open set to the current File explorer folder when you need it.

    [You can also do this with the standard Open command prompt entry]

    Denis
      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 09:20.
Find Us




Windows 10 Forums