I have a registry addition to allow opening any folder in cmd.exe as admin, but it requires cmd.exe to always run as admin.

You can't change cmd.exe itself to do that, because it's protected.

But I found instructions somewhere in the past (which I can't find now) which allowed it by changing the security - I assume changing the permissions. After creating the hardlink, you had to change it back or it wouldn't work normally.

So I believe the process was:

  • change permissions of cmd.exe
  • create hardlink of cmd.exe (something like cmdAdmin.exe)
  • set cmdAdmin.exe to always run as admin
  • revert permissions of cmd.exe

Does anyone know the permissions I need to change (or whatever property it is)?

  • 2
    If you open cmd.exe as Administrator, you will get a Authentication Prompt popping up to accept. You can do much damage in a command prompt so it is protected.
    – John
    Jan 16, 2020 at 11:32
  • 1
    Is there any reason to not change the registry key to start cmd.exe as admin?
    – Seth
    Jan 16, 2020 at 11:45
  • Your question confuses me. I can't really tell what it is that you are asking but I can tell that you are going about this the wrong way. If I knew WHAT "registry addition".. I can probably tell you in about 30 seconds how to accomplish what you are trying to do. If I am guessing correctly, look at the registry stuff for the cmd.exe call. Use something like this instead: powershell -Command "Start-Process cmd -ArgumentList '/s /k pushd \"%V\"' -Verb RunAs" Jan 17, 2020 at 0:04
  • @John So I'm guessing I didn't get the prompt because I've set UAC to never prompt - does cause issues sometimes unfortunately.
    – richjhart
    Jan 17, 2020 at 12:05
  • @SeñorCMasMas it is something like that - but will that command start the cmd process as admin? (if that's what -Verb RunAs does, it's not obvious)
    – richjhart
    Jan 17, 2020 at 12:08

3 Answers 3


If I am guessing correctly, look at the registry stuff for the cmd.exe call. Use something like this instead:

powershell -Command "Start-Process cmd -ArgumentList '/s /k pushd \"%V\"' -Verb RunAs"
  • The "%V" is the current directory passed by the windows explorer.
  • The verb "RunAs" is telling powershell to escalate the process. You can see all of the options avail. to Start-Process here .

I used to disable UAC back in the beginning but now, I don't think that it is a good idea. MOST of the things you are doing shouldn't be spawning the silly UAC dialog. It is a good warning for "HEY! Bad stuff could happen here. This process can do whatever it wants."


This is an example of the XY problem. You don't need to create any hardlink just to run cmd elevated. There are various ways to have a menu item that runs cmd as admin

The simplest way is to apply Andrew Richards' Enhancing the “Open Command Prompt here” Context Menu experience tweak and have the option to run cmd/powershell/bash both as normal and elevated rights

run cmd elevated

run powershell elevated

Just import the below *.reg file (or copy from the MSDN blog above)

Windows Registry Editor Version 5.00

; Command Prompt

"MUIVerb"="Command Prompts"

"MUIVerb"="Command Prompts"

"MUIVerb"="Command Prompt"

@="cmd.exe /s /k pushd \"%V\""

"MUIVerb"="Command Prompt Elevated"

@="cmd.exe /s /k pushd \"%V\""

; PowerShell

"MUIVerb"="PowerShell Prompts"

"MUIVerb"="PowerShell Prompts"


@="powershell.exe -noexit -command Set-Location '%V'"

"MUIVerb"="PowerShell Elevated"

@="powershell.exe -noexit -command Set-Location '%V'"

; Ensure OS Entries are on the Extended Menu (Shift-Right Click)





Use the inbuilt Windows' VB.Net compiler to elevate.

RunAsAdminConsole.exe creates an elevated console or runs a command leaving the console elevated. The program prompts for credentials. Copy following three text files into a folder and double click the batch file.

The advantage of this put in a shortcut is the admin icon overlay appears on the shortcut's icon. If you just tick Run As Admin in compatibility tab it doesn't get the icon overlay.

REM Three files follow
REM RunAsAdminConsole.bat
REM This file compiles RunAsAdminconsole.vb to RunAsAdminconsole.exe using the system VB.NET compiler.
REM Runs a command elevated using a manifest OR elevates the current console without parameters.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc "%~dp0\RunAsAdminconsole.vb" /win32manifest:"%~dp0\RunAsAdmin.manifest" /out:"%~dp0\RunAsAdminConsole.exe" /target:exe
REM To use
rem RunAsAdminconsole 

imports System.Runtime.InteropServices 
Public Module MyApplication  
 Public Sub Main ()
  Dim wshshell as object
  WshShell = CreateObject("WScript.Shell")
  Shell("cmd.exe /k " & Command())
 End Sub 

End Module

Name this file RunAsAdmin.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    name="Color Management"
<description>Serenity's Editor</description>
<trustinfo xmlns="urn:schemas-microsoft-com:asm.v2"> 
        <requestedexecutionlevel level="requireAdministrator" uiAccess="false"/> 

From https://winsourcecode.blogspot.com/2019/12/rem-three-files-followrem.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .