Run as... working folder problem
Moderators: Hacker, petermad, Stefan2, white
Run as... working folder problem
Hello,
I need to use "Run as..." option from right click menu on specific programs. The program's start in folders (working folder) must be their current directories (otherwise they crash).
when I use "Run as..." option in TC (even for the current user), they crash.
To work around this problem, I create lnk files with pre defined start in directories and with these lnk files, "Run as..." worked.
Is there any other way to use "Run as..." without creating lnk files in TC for working directory definition problem?
Thank you in advance
I need to use "Run as..." option from right click menu on specific programs. The program's start in folders (working folder) must be their current directories (otherwise they crash).
when I use "Run as..." option in TC (even for the current user), they crash.
To work around this problem, I create lnk files with pre defined start in directories and with these lnk files, "Run as..." worked.
Is there any other way to use "Run as..." without creating lnk files in TC for working directory definition problem?
Thank you in advance
- ghisler(Author)
- Site Admin
- Posts: 50475
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
No, unfortunately there isn't - TC uses InvokeCommand to execute Start menu entries, it has no influence on the start path and other parameters.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
You could use this in context menu as a workaround:
(tested on XP SP2)
Admin user name and windows directory have to be adjusted to your case (system variables seem to be not working here).
Edit: Added start command for automated removal of temporary cmd window.
Code: Select all
REGEDIT4
[HKEY_CLASSES_ROOT\*\shell\RunAsAdmin]
@="&RunAsAdmin"
[HKEY_CLASSES_ROOT\*\shell\RunAsAdmin\command]
@="\"C:\\WINDOWS\\system32\\RunAs.exe\" /user:\"Administrator\" \"C:\\WINDOWS\\system32\\cmd.exe /c cd /d \"\"\"%1\\..\"\"\"&&start \"\"\"\"\"\" \"\"\"%1\"\"\"\""
Admin user name and windows directory have to be adjusted to your case (system variables seem to be not working here).
Edit: Added start command for automated removal of temporary cmd window.
Last edited by StatusQuo on 2008-05-24, 15:08 UTC, edited 1 time in total.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
-- TC starter menu: Fast yet descriptive command access!
Hi, Status Quo.
How about adding the internal command of cmd.exe, start, in front of the final "%1", i.e. launching start "%1"?
With all the escaped double quotes I did not dare insert the "start" command into your registry source code. Will leave this to you.
Prefixing the "start" command should make the cmd.exe window close once the start command has been executed.
Regards,
Karl
How about adding the internal command of cmd.exe, start, in front of the final "%1", i.e. launching start "%1"?
With all the escaped double quotes I did not dare insert the "start" command into your registry source code. Will leave this to you.

Prefixing the "start" command should make the cmd.exe window close once the start command has been executed.
Regards,
Karl
2karlchen
(It has to be: start "" "%1".)
I now updated (and successfully tested) the code above.
Thanks, that's indeed the solution. I already tried that, but (again) forgot about start's "title" parameter, so it just opened another cmd window instead of the selected program.Prefixing the "start" command
(It has to be: start "" "%1".)
I now updated (and successfully tested) the code above.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
-- TC starter menu: Fast yet descriptive command access!
Hi, StatusQuo,
oh yes, I remember stumbling across this need to insert a(n empty) title into the start commandline.
This results in even a few more escaped double quotes in your registry source code.
I am starting to feel haunted by escaped double quotes. I am going to have an "escaped double quotes" nightmare tonight and wake up shouting out in panic, "You need to escape them!" But there will be no escape ...
Great workaround / solution for the reported issue by the way.
Karl
oh yes, I remember stumbling across this need to insert a(n empty) title into the start commandline.
This results in even a few more escaped double quotes in your registry source code.
I am starting to feel haunted by escaped double quotes. I am going to have an "escaped double quotes" nightmare tonight and wake up shouting out in panic, "You need to escape them!" But there will be no escape ...

Great workaround / solution for the reported issue by the way.

Karl