Windows Vista/7 elevation and cm_OpenAsUser

English support forum

Moderators: white, Hacker, petermad, Stefan2

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

Windows Vista/7 elevation and cm_OpenAsUser

Post by *MVV »

Is there any way to start elevated app using cm_OpenAsUser? When I type login/password, program is opened w/o elevation. I tried to enter my account's login/password but no result.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48028
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

No there isn't - I don't think that this is possible in one step. What you can do is write a small program or script which runs your program with verb "runas" - this causes the elevation.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Thanks for answer.

I've did it already - my little Sudo.exe. :)
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

I want to clear up some details on this command:
1) can cm_OpenAsUser execute programs or start associated files after entering login/password of user that marked as Administrator or member of Administartors group?
2) the same question for user that already logged in Windows?
3) does elevation of Total Commander itself matters for this command?
I tried to use cm_OpenAsUser from TC's command on different file types with my current administrator-level user's login and password on Vista 32 bit, and nothing happens.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
Dalai
Power Member
Power Member
Posts: 9365
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

2DrShark
cm_OpenAsUser is for programs under the cursor. If you want to start other file types, you can prefix the command with an asterisk (*); this can be done in a button and the TC start menu. Starting with TC9 you can also run as a different user (rather than elevated) by putting two asterisks in front of the command line. The latter is also useful when UAC is disabled.

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
Cruysen
Junior Member
Junior Member
Posts: 18
Joined: 2012-09-28, 08:31 UTC
Location: St.Hubert nl
Contact:

Post by *Cruysen »

Yes there is are several ways:

Use Sudo from the totalcmd.net site or nircmd from NirSoft.
Or use the setting 'run as adminstrator'
But then the UAC prompt shows up.

Run without UAC prompt
Create elevated shortcut to skip UAC prompt in Windows 10

Or use: Winaero Tweaker
Search there for 'elevated shortcut'

Edit to comment MVV: Sorry, understood your topic wrong.
These are ways to start Totalcmd or any program elevated. Others can take this reaction just for information. 8)
Last edited by Cruysen on 2017-04-13, 09:49 UTC, edited 1 time in total.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Have you read the topic? It was about cm_OpenAsUser command, and it still can't elevate programs. Alternative solutions were already mentioned: my Sudo tool (which you've linked) and asterisk before program path.
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

Dalai wrote:cm_OpenAsUser is for programs under the cursor.
To start a program that have enabled "As Administrator" option it the exe properties using cm_OpenAsUser, TC itself must be started as Administrator.
Dalai wrote:If you want to start other file types, you can prefix the command with an asterisk (*);
Just to make it clear: it seems that here the "command" word doesn't mean the cm_OpenAsUser command mentioned above, it's about the program name in the "Command:" field of the "Change single button" dialog.
Dalai wrote:Starting with TC9 you can also run as a different user (rather than elevated) by putting two asterisks in front of the command line. The latter is also useful when UAC is disabled.
With 2 asterisks (**c:\Windows\notepad.exe or **%COMMANDER_EXE% as a command in a button) I get an error here on Vista 32 bit:

Code: Select all

---------------------------
Total Commander
---------------------------
Error executing program! (31)
---------------------------
ОК   
---------------------------
It doesn't matter whether TC started elevated or not.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

To start a program that have enabled "As Administrator" option it the exe properties using cm_OpenAsUser, TC itself must be started as Administrator.
I don't think that elevation will be kept if you enter another user credentials...
With 2 asterisks (**c:\Windows\notepad.exe or **%COMMANDER_EXE% as a command in a button) I get an error here on Vista 32 bit:
Works fine for me under Windows 7x64.
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

MVV wrote:
DrShark wrote:To start a program that have enabled "As Administrator" option it the exe properties using cm_OpenAsUser, TC itself must be started as Administrator.
I don't think that elevation will be kept if you enter another user credentials...
If Total Commander is not started as Administartor, after cm_OpenAsUser on .exe with "As Administrator" property enabled nothing is started (in this post my "nothing happens" words are about such case because that time all exe files I tried to start had "As Administrator" property enabled.)
MVV wrote:
DrShark wrote:With 2 asterisks (**c:\Windows\notepad.exe or **%COMMANDER_EXE% as a command in a button) I get an error here on Vista 32 bit:
Works fine for me under Windows 7x64.
I just tried the following button:

Code: Select all

TOTALCMD#BAR#DATA
**c:\windows\System32\cmd.exe

%COMSPEC%


0
-1
in TC started with clean wincmd.ini and even with a new bar for this button, but still get the error 31.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Well, two asterisks work fine for me even if I set 'As administrator' compatibility feature for application. Perhaps you have some kind of Vista issue.
User avatar
Phred
Senior Member
Senior Member
Posts: 375
Joined: 2009-06-16, 15:24 UTC
Location: SEAu

How To

Post by *Phred »

MVV wrote:...
...
Works fine for me under Windows 7x64.
On your site, MVV, the 'here' words are not links, and any other discussion appears absent.
I'd love to know how to use Sudo, but I'm not imaginative enough.
Any chance of instructions/discussion?
Regards, PhredE
Licence holder since 1999
Awaiting a $D donors-token for the title-bar so we can display that we have donated further.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Where is my site? :)
If you want to try my Sudo, please check my signature.

And using it is pretty easy - just append entire command line to it:

Code: Select all

cmd.exe /c echo Without Sudo & pause

Code: Select all

Sudo.exe cmd.exe /c echo With Sudo & pause
I usually put following su.bat file to Windows or System32 dir so I can start elevated command line in current directory by typing su into TC command line:

Code: Select all

@echo off
start "" "%SystemRoot%\System32\sudo.exe" "%SystemRoot%\System32\cmd.exe" /k "set prompt=$p# & cd /d "%cd%""
Last edited by MVV on 2017-05-24, 07:21 UTC, edited 2 times in total.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

Starting a program with 2 asteriks in front works fine here under Windows 10 x64
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

2ghisler(Author)
Do you have ideas why the command and the asterisks fail to launch programs in cases mentioned in this post? I asked you in email from June 8, 2017 about it, but so far I didn't receive a reply (btw I sent 3 emails to TC support email address on June 8, each on different topic, did you get them?)
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Post Reply