It is currently April 25th, 2024, 12:54 am
Run CMD.EXE as Administrator from Rainmeter
-
- Posts: 136
- Joined: December 27th, 2016, 12:04 pm
Re: Run CMD.EXE as Administrator from Rainmeter
Thanks - I will try this later.
-
- Posts: 41
- Joined: January 24th, 2022, 2:54 pm
- Location: World Wide Web
Re: Run CMD.EXE as Administrator from Rainmeter
I know this thread is old but here is a little work around if you want to run cmd as administrator but without using CMD.exe itself. Just make file e.g. rain-cmd.bat and edit it and paste this code below:
Code: Select all
:: Admin permission
set "params=%*"
cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )>nul
Brought to you by: https://kurou.dev/
-
- Posts: 136
- Joined: December 27th, 2016, 12:04 pm
Re: Run CMD.EXE as Administrator from Rainmeter
Kurou: thanks; but we could use explanation of what that code does / how it does it.
-
- Posts: 1366
- Joined: September 7th, 2020, 2:24 pm
- Location: QLD, Australia
Re: Run CMD.EXE as Administrator from Rainmeter
Like SilverAzide said, running rainmeter in admin mode will automatically run linked programs in the elevated state.
It works for me for 'almost everything'. That includes PowerShell AND command prompt, when run that way. so the best of both worlds. Elevated state, and no yes/no prompts.
Cannot really see why that requires more in detailed RunCommand inline scripts, since the desired outcome is viable and functional in this method?
So I saw this and saw it was old but the OP chimed in, and I though to add my two cents.
It works for me for 'almost everything'. That includes PowerShell AND command prompt, when run that way. so the best of both worlds. Elevated state, and no yes/no prompts.
Cannot really see why that requires more in detailed RunCommand inline scripts, since the desired outcome is viable and functional in this method?
So I saw this and saw it was old but the OP chimed in, and I though to add my two cents.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.