Page 1 of 1
How to run command from command line as admin?
Posted: 2024-02-05, 17:15 UTC
by KozakMak
Maybe there is some kind of hotkey for this?
PS. I know about * in buttons, i need from command line directly.
Re: How to run command from command line as admin?
Posted: 2024-02-05, 17:21 UTC
by Horst.Epp
Select "As Administrator" from the right click of your normal Cmd button.
There is no hotkey or anything else for this.
Re: How to run command from command line as admin?
Posted: 2024-02-05, 17:49 UTC
by KozakMak
Ctrl+Shift+Enter (as in Win+R) would be nice.
Move the topic then to "TC suggestions".
Re: How to run command from command line as admin?
Posted: 2024-02-05, 18:15 UTC
by JOUBE
KozakMak wrote: ↑2024-02-05, 17:15 UTC
I know about * in buttons, i need from command line directly.
Support++.
I also want to have that * in the command line.
Thanks for making this suggestion.
I try to use it - really - every day... for example "*cmd" and it doesn't work...
It is simple and fast and perfectly to use, faster than every hotkey.
Hopefully simple to implement and perfect for adding it in Tc11.03rc05
Joube
Please Moderators: Move this threat to forum "suggestions". Thanks
Re: How to run command from command line as admin?
Posted: 2024-02-05, 19:17 UTC
by NotNull
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: Select all
@echo off
:: Create dummy script
set RANDOM=>"%temp%\%~n0.ELEVATE"
:: File association: Run .ELEVATE always elevated
reg add HKCU\Software\Classes\.elevate /ve /D MaartenElevate /F >nul
reg 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 up
rem reg delete HKCU\Software\Classes\.elevate /F >nul
rem reg delete HKCU\Software\Classes\MaartenElevate /F >nul
rem del /Q "%temp%\%~n0.ELEVATE"
Re: How to run command from command line as admin?
Posted: 2024-02-05, 20:42 UTC
by JOUBE
NotNull wrote: ↑2024-02-05, 19:17 UTC
Workaround ...
sudo.cmd
Ok, nice.
I use "elevate"
elevate - Command-Line UAC Elevation Utility for things like this. *)
...but would prefere the TCs
* at the Tc command line
Joube
*) and
IsAdmin for already Admin checks and so on...
Re: How to run command from command line as admin?
Posted: 2024-02-06, 00:19 UTC
by white
Moderator message from: white » 2024-02-06, 00:19 UTC
Moved to Suggestions forum.
Re: How to run command from command line as admin?
Posted: 2024-02-06, 10:52 UTC
by petermad
Support++ for * also working in the command line
Re: How to run command from command line as admin?
Posted: 2024-02-07, 20:57 UTC
by NotNull
JOUBE wrote: ↑2024-02-05, 20:42 UTC
and IsAdmin for already Admin checks
Completely off-topic:
AdminCheck.cmd
Code: Select all
@whoami /groups | findstr /i "S-1-16-16384 S-1-16-12288" >nul && echo YES || echo NO
But as said: workaround. Would be a good thing if this suggestion got implemented.
Re: How to run command from command line as admin?
Posted: 2024-02-08, 07:36 UTC
by JOUBE
NotNull wrote: ↑2024-02-07, 20:57 UTC
Would be a good thing if this suggestion got implemented.
Yes, also for everyone who is familiar with the command line and usually uses the command line. This is quicker, easier and more convenient than selecting a menu or a button or special hotkeys and so on.
Your suggestion++.
Joube