Skip to content

Instantly share code, notes, and snippets.

@Sopor
Last active May 15, 2024 17:10
Show Gist options
  • Save Sopor/250e35d2bce15c14ca9e3fc679a410eb to your computer and use it in GitHub Desktop.
Save Sopor/250e35d2bce15c14ca9e3fc679a410eb to your computer and use it in GitHub Desktop.
Total Commander - Open Command Prompt in current window as Administrator without showing that annoying UAC warning
@echo off
SETLOCAL
if /i %1==scheduler goto SCHEDULER
echo %1 >%temp%\tcelevatedcmd.tmp
C:\Windows\System32\schtasks.exe /run /tn "RunStartCMD"
goto END
:SCHEDULER
set /P startcmdpath=<%TEMP%\tcelevatedcmd.tmp
c:\utils\nircmd\nircmdc.exe elevate %ComSpec% /K cd /d "%startcmdpath%"
if EXIST "%temp%\tcelevatedcmd.tmp" DEL "%temp%\tcelevatedcmd.tmp"
:END
@Sopor
Copy link
Author

Sopor commented May 15, 2024

  • Download NirCmd and extract it to c:\utils\nircmd.

  • In the above window click Raw and save it as RunStartCMD.cmd in c:\utils.

  • Create a button in Total Commander that look like this or add it in usercmd.ini (creating a button is much easier):
    image

  • Run Task Scheduler by open Run (Winkey+R) and type in taskschd.msc and press ENTER.
    Navigate to Task Scheduler and expand it and right click on Task Scheduler Library and Create Task:
    image

  • Type in a name, check Run with highest privileges, Hidden and change to Windows 10:
    image

  • Change to the tab Action and click New..., type in the path to the batch file and type scheduler as arguments:
    image

  • Change to the tab Conditions and set it as the picture shows:
    image

  • Change to the tab Settings and set it as the picture shows:
    image

Press OK to save it!

You should now be able to open a command prompt window as Administrator in current directory without that annoying UAC warning...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment