How-to Run TC as Administrator?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
CWBillow
Member
Member
Posts: 121
Joined: 2006-01-28, 04:38 UTC
Location: San Diego, CA, USA

How-to Run TC as Administrator?

Post by *CWBillow »

I know I can set up a TC shortcut and give it Administrative rights, but I also want to be able to set it up via command-line.

Is this possible?

Regards,
Chuck Billow
User avatar
petermad
Power Member
Power Member
Posts: 16123
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

From the command line use:

powershell.exe -Command "Start-Process totalcmd.exe -Verb RunAs"

Provided that your system has PowerShell, of course.
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Dalai
Power Member
Power Member
Posts: 10029
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

Without PowerShell, you can also use Elevate, like this:

Code: Select all

elevate.exe c:\path\to\totalcmd.exe
Or, if you disabled UAC and want to launch TC as different user:

Code: Select all

runas.exe /user:Administrator c:\path\to\totalcmd.exe
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

My Sudo tool also allows starting elevated processes.
User avatar
CWBillow
Member
Member
Posts: 121
Joined: 2006-01-28, 04:38 UTC
Location: San Diego, CA, USA

Post by *CWBillow »

petermad wrote:From the command line use:

powershell.exe -Command "Start-Process totalcmd.exe -Verb RunAs"

Provided that your system has PowerShell, of course.
Peter, I get an error that running scripts has been disabled.

Chuck
User avatar
petermad
Power Member
Power Member
Posts: 16123
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

Peter, I get an error that running scripts has been disabled.
Hmm, I haven't actively enabled scripts, so they must be enabled by default. So something in your system must have disabled them - maybe your anti-virus program.

Here it works out-of-the-box under Windows 7, Windows 8.1 and Windows 10
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

Try

Code: Select all

powershell.exe -ExecutionPolicy remotesigned -Command "Start-Process totalcmd.exe -Verb RunAs"
User avatar
CWBillow
Member
Member
Posts: 121
Joined: 2006-01-28, 04:38 UTC
Location: San Diego, CA, USA

Post by *CWBillow »

I'll give
powershell.exe -ExecutionPolicy remotesigned -Command "Start-Process totalcmd.exe -Verb RunAs"

A try.

Thanks,
Chuck
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

CWBillow,
Nevertheless starting elevated app via mentioned tools is much faster because PowerShell need some time to load...
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

PowerShell: Set-ExecutionPolicy -ExecutionPolicy remotesign

Post by *Stefan2 »

petermad wrote:
Peter, I get an error that running scripts has been disabled.
Hmm, I haven't actively enabled scripts, so they must be enabled by default. So something in your system must have disabled them - maybe your anti-virus program.

Here it works out-of-the-box under Windows 7, Windows 8.1 and Windows 10
The PowerShell execution policy is set to "Restricted" on default.
The Windows PowerShell execution policies are as follows:

"Restricted" is the default policy.

Restricted
- Default execution policy in Windows 8,
Windows Server 2012, and Windows 8.1.

- Permits individual commands, but will not run
scripts.

- Prevents running of all script files, including
formatting and configuration files (.ps1xml), module
script files (.psm1), and Windows PowerShell
profiles (.ps1).

https://technet.microsoft.com/en-us/us-en/library/hh847748.aspx
PS> help about_Execution_Policies

You have to modify the policy by executing "Set-ExecutionPolicy"
https://technet.microsoft.com/en-us/us-en/library/hh849812.aspx
PS> help Set-ExecutionPolicy

or by setting it explicitly on the command line as ZoSTeR shows:
PowerShell.exe -ExecutionPolicy xyz
https://msdn.microsoft.com/de-de/powershell/scripting/core-powershell/console/powershell.exe-command-line-help
PS> powershell.exe /?



 
User avatar
vdijken
Member
Member
Posts: 181
Joined: 2016-07-30, 14:07 UTC
Location: The Netherlands

Post by *vdijken »

When you right-click on the windows symbol you can choose a cmd windows as administrator. Go to the map with Total Commander and execute TC.
richardw
Junior Member
Junior Member
Posts: 12
Joined: 2010-07-29, 19:20 UTC
Location: British Columbia, Canada

Post by *richardw »

petermad wrote:From the command line use:

powershell.exe -Command "Start-Process totalcmd.exe -Verb RunAs"

Provided that your system has PowerShell, of course.
Hi, petermad

Thank you for this suggestion. I've got Powershell, and this seems to work for me. I just don't totally get the syntax.

If I can paraphrase, this appears to basically be saying "start totalcmd.exe with the Verb RunAs". I would expect there to be an additional argument, for example "with the Verb RunAs Admin" My guess is that the reason that "Admin" is not explicitly stated is because Admin is the default argument of RunAs. Is that correct? I'm trying to understand how this starts Totalcmd.exe as user Admin, and I can't find the documentation for RunAs.

Thanks,
richardw, out-of-touch ex-programmer
Registered Total Commander user (and loyal supporter) since 1997
Post Reply