Run custom tool on Shift+Enter

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
mmatrosov
Junior Member
Junior Member
Posts: 14
Joined: 2013-01-04, 19:07 UTC
Location: Russia

Run custom tool on Shift+Enter

Post by *mmatrosov »

I want to run Console utility (see it on SourceForge) when Shift+Enter is hit by user. I'm using NoClose Replacer (google it, since I cannot post URLs yet) for this task. In NoClose.ini file I write the following:

Code: Select all

CommandProcessor="C:\Program Files\Console2\Console.exe" -r "/K %1"
This works fine for simple command lines. But when there are quotes or stream redirections in a command line, Console.exe cannot properly parse its -r argument.

I have no such problems with standard cmd.exe, with the following:

Code: Select all

CommandProcessor=cmd /S /K "%1"
As it is said in the help for cmd.exe, the outer quotes are stripped away before processing the command line.

Is there a way to make Console utility work for this scenario?
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

Try this:

Code: Select all

[General]
CommandProcessor=""c:\Program Files\TotalCmd\Tools\Console\Console.exe" -r "%comspec% /K %1""
You have to double quote (ie requote) the whole line and use comspec.
This works at least for something like

Code: Select all

dir > "c:\some file.txt"
mmatrosov
Junior Member
Junior Member
Posts: 14
Joined: 2013-01-04, 19:07 UTC
Location: Russia

Post by *mmatrosov »

ZoSTeR wrote:Try this:

Code: Select all

[General]
CommandProcessor=""c:\Program Files\TotalCmd\Tools\Console\Console.exe" -r "%comspec% /K %1""
You have to double quote (ie requote) the whole line and use comspec.
This works at least for something like

Code: Select all

dir > "c:\some file.txt"
Doesn't work for me. At least with the following simple command line:

Code: Select all

"n:\Program Files (x86)\ffmpeg-20120919-git-cb3591e-win32-static\bin\ffmpeg.exe"
Note spaces in the path and quotes around it. BTW, what is %comspec%?
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

mmatrosov,
If you need to put quoted string into INI parameter, you need to add enclosing quotes for entire parameter value, as ZoSTeR suggested. INI read function removes outer quotes if they are present.

%ComSpec% is a system variable that contains path to cmd.exe.
Post Reply