tcmd F4 run notepad++ as administrator

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
lebede
Junior Member
Junior Member
Posts: 2
Joined: 2013-04-30, 11:45 UTC

tcmd F4 run notepad++ as administrator

Post by *lebede »

Hi, I want to run notepad++ as administrator by pressing F4 key (edit file), so I did:

1. notepad++.exe - properties - Compatibility- Privilege Level - Run this program as administrator

2. totalcomander - COnfiguration - Options - view and editing - set path for editor c:\prog\notepad++\notepad++.exe

But totalcommander write "File was not found. c:\prog\notepad++\notepad++.exe"

What can I do to run it??

Thanks!
umbra
Power Member
Power Member
Posts: 871
Joined: 2012-01-14, 20:41 UTC

Post by *umbra »

This looks more like an error and applies to applications that are set with "Comparetool=" or "Editor=" in wincmd.ini.

If they are configured to run with admin privileges and TC itself is not, the mentioned error occurs. But they work, if both TC and the tools have the same level of privileges - if both (or none of them) are running as admin.
Windows 7 Pro x64, Windows 10 Pro x64
lebede
Junior Member
Junior Member
Posts: 2
Joined: 2013-04-30, 11:45 UTC

Post by *lebede »

Exactly! Thats working!
Both run as administrator.
Thanks!
umbra
Power Member
Power Member
Posts: 871
Joined: 2012-01-14, 20:41 UTC

Post by *umbra »

I wouldn't call that a solution. At best it's a workaround. Anyway, glad to help.
Windows 7 Pro x64, Windows 10 Pro x64
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

lebede wrote:Exactly! Thats working!
Both run as administrator.
Thanks!
Its useless to configure the editor to run as admin if TC is running as admin.
In this case the editor is running as admin automatically.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

lebede,
You can use my Sudo tool (link in signature, put it into TC dir), just enter following editor path:

Code: Select all

"%COMMANDER_PATH%\Sudo.exe" "c:\prog\notepad++\notepad++.exe" "%1"
You don't need to set notepad's compatibility in such case.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This doesn't work because TC uses WinExec to start the editor. Unfortunately WinExec does not support elevation, only ShellExecute(Ex) does.
Author of Total Commander
https://www.ghisler.com
Luzie
Junior Member
Junior Member
Posts: 91
Joined: 2003-02-27, 07:58 UTC

Post by *Luzie »

ghisler(Author) wrote:This doesn't work because TC uses WinExec to start the editor. Unfortunately WinExec does not support elevation, only ShellExecute(Ex) does.
Any solution to this one? I have the same problem if i want to use Editor=""%COMMANDER_PATH%\UTILITY\Crimson Editor Portable\cedt-286-portable\cedt.exe" "%1"" in WINCMD.INI
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Luzie,
Use my Sudo tool, it works in such case.
Luzie
Junior Member
Junior Member
Posts: 91
Joined: 2003-02-27, 07:58 UTC

Post by *Luzie »

MVV wrote:Luzie,
Use my Sudo tool, it works in such case.
Hi MVV,

thanks for your reply/suggestion. I tried your SUDO yesterday (before posting here) and today, but this not fixes my problem (or I made somehting wrong).

However I found a solution while testing:

I linked a Batch-File in WINCMD.INI with setting:

Code: Select all

"Editor=""%COMMANDER_PATH%\BATCH\F4EDITOR.BAT" "%1""
and this F4EDITOR.BAT opens my Editor and File. F4EDITOR.BAT containing this Code:

Code: Select all

"%COMMANDER_PATH%\UTILITY\Crimson Editor Portable\cedt-286-portable\cedt.exe" %1
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I've tried to set up administrator rights for an app and TC was able to start it via Sudo as an editor...
Luzie
Junior Member
Junior Member
Posts: 91
Joined: 2003-02-27, 07:58 UTC

Post by *Luzie »

MVV wrote:I've tried to set up administrator rights for an app and TC was able to start it via Sudo as an editor...
OK. My problem was the other way round: I start TC as Admin and then starting Editor with F4 works. But when I start TC without Adminrights, then Editor via F4 don´t work and it raises only Error-Message for wrong link. With the way I discovered yesterday (starting Editor from Batch) it work with and without Admin-Rights.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

That's strange because Sudo works fine for me when I start TC w/o admin rights.
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

Luzie wrote:
ghisler(Author) wrote:This doesn't work because TC uses WinExec to start the editor. Unfortunately WinExec does not support elevation...
... I have the same problem if i want to use Editor=""%COMMANDER_PATH%\UTILITY\Crimson Editor Portable\cedt-286-portable\cedt.exe" "%1"" in WINCMD.INI
Luzie wrote:... I found a solution while testing:
...
and this F4EDITOR.BAT opens my Editor and File.
There's no need for a separate .bat file if cmd.exe is used to start the editor:
http://ghisler.ch/board/viewtopic.php?p=328408#328408
MVV wrote:You can use my Sudo tool (link in signature, put it into TC dir), just enter following editor path:

Code: Select all

"%COMMANDER_PATH%\Sudo.exe" "c:\prog\notepad++\notepad++.exe" "%1"
Since Sudo doesn't have the documentation, I suggest to add similar example of Sudo usage either to program's Totalcmd.net page or as a built-in help shown after calling the sudo with /? or -help parameter.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Post Reply