Quantcast
Channel: Total Commander
Viewing all articles
Browse latest Browse all 3820

TC suggestions (English) • Re: How to run command from command line as admin?

$
0
0
Workaround ...

I wrote SUDO.cmd that can help here. Using it daily without issues, but there might be some edge cases that I haven't run into (yet).
Start SUDO without parameters ans it will launch an elevated CDM prompt.
Start it with SUDO <your command> [options for your command], like sudo regedit -m and it will run that command elevated.
Put sudo.cmd somewhere where TC can find it.





SUDO.cmd

Code:

@echo off:: Create dummy scriptset RANDOM=>"%temp%\%~n0.ELEVATE":: File association: Run .ELEVATE always elevatedreg add HKCU\Software\Classes\.elevate /ve /D MaartenElevate /F >nulreg add HKCU\Software\Classes\MaartenElevate\Shell\runas\command /ve /D "cmd.exe /c pushd \"%%w\" & start \"%~n0\" %%*" /F >nul:: Execute dummy .ELEVATE script"%temp%\%~n0.ELEVATE" %*:: Clean upremreg delete HKCU\Software\Classes\.elevate /F >nulremreg delete HKCU\Software\Classes\MaartenElevate /F >nulremdel /Q "%temp%\%~n0.ELEVATE"

Statistics: Posted by NotNull — 2024-02-05, 19:17 UTC



Viewing all articles
Browse latest Browse all 3820

Trending Articles