Ctrl+Shift+Enter on batch to elevate & keep window opene
Moderators: white, Hacker, petermad, Stefan2
Ctrl+Shift+Enter on batch to elevate & keep window opene
I've been looking for a way to quickly open a .cmd / .bat file as Administrator and keep the window opened.
Shift+Enter already runs the batch file and keeps the window opened. Perhaps Ctrl+Shift+Enter could be used to open elevated and keep command prompt opened?
If there's any alternative, I'd love to hear so. Actually, after reading this, I thought there would be a way to set Run&Keep window as default (with Enter), OR at least always let TC show the internal associations popup on Enter. However, it seems that with current versions (9.10-9.12RC4) .bat/.cmd Enter can not be overwritten (anymore?).
Shift+Enter already runs the batch file and keeps the window opened. Perhaps Ctrl+Shift+Enter could be used to open elevated and keep command prompt opened?
If there's any alternative, I'd love to hear so. Actually, after reading this, I thought there would be a way to set Run&Keep window as default (with Enter), OR at least always let TC show the internal associations popup on Enter. However, it seems that with current versions (9.10-9.12RC4) .bat/.cmd Enter can not be overwritten (anymore?).
You can assign any command to Ctrl+Shift+Enter, but it will be the only command for all file types. If you want to start elevated batch and keep window opened, you can use e.g. following command:
Just go to Options/Misc, select Ctrl+Shift+Enter shortcut and define such a command in usercmd.ini category (which is intended for user-defined commands).
Code: Select all
Command: %ComSpec%
Parameters: /k "cd /d "%P" & call "%P%N""
You forgot the asterisk * before %comspec%, but yeah, that'll work for this. Thanks!MVV wrote:You can assign any command to Ctrl+Shift+Enter, but it will be the only command for all file types. If you want to start elevated batch and keep window opened, you can use e.g. following command:Just go to Options/Misc, select Ctrl+Shift+Enter shortcut and define such a command in usercmd.ini category (which is intended for user-defined commands).Code: Select all
Command: %ComSpec% Parameters: /k "cd /d "%P" & call "%P%N""
I was distracted by trying to overwrite Enter via internal associations. Still don't get why that shouldn't work.
Yes, you're right, I've missed the asterisk.
Strange, I've just tried to associate cm_Config with ENTER key, and it works: I press Enter on a file and get configuration dialog.
Code: Select all
Command: *%ComSpec%
Parameters: /k "cd /d "%P" & call "%P%N""