Page 1 of 1

tcmd F4 run notepad++ as administrator

Posted: 2013-04-30, 12:41 UTC
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!

Posted: 2013-04-30, 13:38 UTC
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.

Posted: 2013-04-30, 13:44 UTC
by lebede
Exactly! Thats working!
Both run as administrator.
Thanks!

Posted: 2013-04-30, 14:00 UTC
by umbra
I wouldn't call that a solution. At best it's a workaround. Anyway, glad to help.

Posted: 2013-04-30, 14:11 UTC
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.

Posted: 2013-04-30, 17:14 UTC
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.

Posted: 2013-05-02, 13:45 UTC
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.

Posted: 2017-07-17, 20:26 UTC
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

Posted: 2017-07-18, 08:01 UTC
by MVV
Luzie,
Use my Sudo tool, it works in such case.

Posted: 2017-07-18, 21:21 UTC
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

Posted: 2017-07-19, 08:53 UTC
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...

Posted: 2017-07-19, 15:21 UTC
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.

Posted: 2017-07-19, 15:25 UTC
by MVV
That's strange because Sudo works fine for me when I start TC w/o admin rights.

Posted: 2017-07-27, 14:32 UTC
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.