Page 2 of 2

Posted: 2009-11-03, 10:32 UTC
by MVV
sticazzi wrote:2- Is it possible to use Shift-Enter with tcc.exe in the TC's command line (command line box is not hidden)?
3- Using tcc.exe instead of cmd.exe, TC would be really portable (all stuff in the pendrive: no noclose.pif, etc. to put it inside HostPC's windows folder), right?
Currently there is no way to change TC action on Shift+Enter in command line - it always tries to execute noclose.pif in Windows folder.

Posted: 2009-11-03, 12:12 UTC
by Balderstrom
I believe, if you use Flint's NoClose replacer mentioned in this thread you can change the NoClose.ini file that goes with it (Both are within C:\Windows):
[General]
CommandProcessorNT=cmd.exe /k
CommandProcessor9x=command.com /K
ShowWindow=normal
ShortcutWaitDelay=0

[Shortcuts]
Change "cmd.exe /k" to "tcc.exe" - it may need /k as well?

That will cause any .BAT files to be executed with TCC.exe when you Shift+Enter on them.
Unfortunately Mr.Ghisler has refused(?) to make this also apply to .cmd files. Thus I never realized that noclose.pif actually works since it will only ever be triggered for .bat files -- which I haven't used in 5 years, I've switched to the .cmd extension long ago.

@MVV
The request mentioned above (Behaviour that wont be changed) from (May) 2007 asked to use %comspec% /k instead of noclose.pif for Shift+Enter.

Posted: 2009-11-03, 14:58 UTC
by Balderstrom
And for good measure, an AHK solution:
In Total Commander, create user-defined command: em_ShiftEnter
Assign to TC Shortcut (Hotkey) Shift + Enter
Command: "%ProgramFiles%\AutoHotKey\AutoHotKey.exe" "C:\Location\of\Scripts\TCShiftEnter.ahk"
Parameters: "%O" "%E"
Create TCShiftEnter.ahk, put in scripts location (C:\Location\of\Scripts)

Code: Select all

;;
;; TCShiftEnter.ahk
;;
ControlGetFocus, aControl, A
if( !RegExMatch( aControl, "^TMyListBox[1-2]$" ))
{
	Send, +{Enter}
	return
}
ext = %2%
if( RegExMatch( ext, "i)^(bat|cmd)$" ) )
	Run, cmd.exe /k "%1%.%2%"
else
	Run, "%1%.%2%"
return
Where you would like to use tcc.exe instead of cmd.exe, replace above.

Advantage,
1) can launch any file with it's associated program.
2) If the File is .cmd or .bat will launch a cmd prompt window instead.
3) AutoHotKey.exe and related .ahk scripts can be contained within the TotalCmd path -- instead of having to be copied to C:\Windows (i.e. noClose.pif).

(Can probably be done with a basic .cmd script as well, though without the Control checking exceptions)
Edit: Removed "cmd.exe /c START" from the 2nd Run statement (not needed).

Posted: 2009-11-03, 23:37 UTC
by sticazzi
many thanks guys :)