Skip to content

Instantly share code, notes, and snippets.

@Sopor
Last active February 13, 2025 13:42
Show Gist options
  • Save Sopor/57f21eaa12be62b3592b0fdcf2477799 to your computer and use it in GitHub Desktop.
Save Sopor/57f21eaa12be62b3592b0fdcf2477799 to your computer and use it in GitHub Desktop.
Total Commander - Open command prompt window as Administrator without showing that annoying UAC warning
@echo off
SETLOCAL
if /i %1==scheduler goto SCHEDULER
echo %1 >%TEMP%\tcelevatedcmd.tmp
"%SystemRoot%\System32\schtasks.exe" /run /tn "TotalCMDRunAdm"
goto END
:SCHEDULER
set /P startcmdpath=<%TEMP%\tcelevatedcmd.tmp
"%APPDATA%\GHISLER\Command_Prompt.lnk" /K cd /d "%startcmdpath%"
:END
@Sopor
Copy link
Author

Sopor commented Dec 31, 2024

  • Open %APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools in the left window of Total Commander.
  • Open %APPDATA%\Roaming\GHISLER in the right window of Total Commander.
Expand to view picture

image

  • In the top window click Raw and save it as totalcmdadm.cmd (or click on Download ZIP and extract the file) in %APPDATA%\Roaming\GHISLER (the right window).
  • Copy Command Prompt.lnk from the left window to the right and at the same time rename the file to Command_Prompt.lnk.
  • Right click and select Properties on the Command_Prompt.lnk in the right window.
Expand to view picture

image

  • Click on Advanced and enable Run as administrator and click OK and OK again to close properties.
Expand to view picture

image

  • Create a button in Total Commander or add it in usercmd.ini (creating a button is much easier).
Expand to view picture

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.
Expand to view picture

image

  • Type in a Name, check Run with highest privileges, Hidden and change to Windows 10.
Expand to view picture

image

  • Change to the tab Action and click New..., type in the path to the batch file and type scheduler as arguments.
Expand to view picture

image

  • Change to the tab Conditions and set it as the picture below.
Expand to view picture

image

  • Change to the tab Settings and set it as the picture below.
Expand to view picture

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 by clicking on the button you have created in the button bar of Total Commander...

NOTE: This will not work if you are remotely connected to the computer over RDP!

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