tcc /c "[...]" fails when run from third party terminal

Aug 16, 2008
124
0
Hi,

I normally run TCC from ConEmu/FAR Manager[1]. FAR has a command prompt. FAR passes the commands to ComSpec via '%ComSpec% /c "command"'.

So when I execute "alias where" in FAR, FAR runs TCC and I see the result in FAR's terminal. This also works when I run FAR in conjunction with Console Emulator.

Console Emulator has a FAR plugin which enables tighter integration between FAR and Console Emulator[2]. When I load the plugin, commands like "alias where" start failing in FAR:

> alias where
TCC: Unknown command "alias where"

I reported this as a bug to the developer of Console Emulator. He replied that this is not a bug in the Console Emulator plugin ("Where is a bug?") but in TCC(!) because when I run ("from Windows")

[Win+R] tcc.exe /C "alias where" & cmd

it also fails with "TCC: Unknown command "alias where"".

I replied "Whatever the plugin does, it makes the commands fail that work without the plugin. This is obviously a bug."

Can anyone offer some insight into this issue?

Thorsten
[1] http://jpsoft.com/blogs/2012/04/windows-console-replacements-part-6-take-command-and-conemu/
[2] https://code.google.com/p/conemu-maximus5/wiki/ConEmuFarPlugin#ConEmu
 

samintz

Scott Mintz
May 20, 2008
1,503
16
Solon, OH, USA
I'm running TCC v15.01.52 and I get expected behavior.
Code:
TCC: Not an alias "where"

Try running your command without the quotes:
Code:
tcc /c alias where

It's possible that the version of TCC you are running is trying to run "alias where" as opposed to ALIAS with an argument of "where".
-Scott
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Scott, I think you found the issue. TCC does not expect the whole command line to be quoted, which is the reason the failing command is shown as "alias where". The author of the FAR plugin did not test a valid invocation of TCC with Win+R:
tcc /c alias where
does not fail! FAR should give the user the option whether or not to quote the command line to be passed, so the TCC command it passes should look like:
%ComSpec% /c alias where

Of course, starting and stopping TCC (and all its DLLs) for each command you want to execute is not only very inefficient, but prevents you from using the start-up options you find in TCMD Help / TCC / Starting TCC / TCC Startup Options; some of them you can emulate in the default TCMD.INI, some others in TCSTART.BTM. Furthermore, since each invocation starts with the same bare environment passed by Windows or by ConEmu, results of a command are not available in subsequent commands.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,466
88
Albuquerque, NM
prospero.unm.edu
CMD.EXE has a fairly whimsical set of rules for deciding whether to strip or retain leading/trailing quote marks on its startup command line. Type CMD /?, hit Enter and then press the spacebar once to see the executive summary.

Should TCC.EXE emulate this Rube Goldberg behavior?
 
May 20, 2008
3,515
4
Elkridge, MD, USA
CMD.EXE has a fairly whimsical set of rules for deciding whether to strip or retain leading/trailing quote marks on its startup command line. ... Should TCC.EXE emulate this Rube Goldberg behavior?

Absolutely NOT as default, though when Duplicate CMD bugs is selected, some may find it useful. While the CMD rules you referenced are not totally nonsensical (they seemed designed to retain quotation marks around one single LFN containing white space but without parentheses or other special characters in the filename, and no additional quoted strings in the command line), they are still incapable of passing many other potential strings to the TCC command specified. If in fact the OP wanted TCC to execute a batch file whose name contains white space, with a parameter string, the command format would be (e.g. to invoke TCC from a RUN box) %ComSpec% /c "lfn with space" parameter
 

rconn

Administrator
Staff member
May 14, 2008
12,356
150
CMD.EXE has a fairly whimsical set of rules for deciding whether to strip or retain leading/trailing quote marks on its startup command line. Type CMD /?, hit Enter and then press the spacebar once to see the executive summary.

Should TCC.EXE emulate this Rube Goldberg behavior?


Actually, TCC does emulate most of the (bizarro) CMD behavior with multiple quotes (mostly in the wrong places) on the startup command line. This one particularly twisted syntax of quoting part of the command line and arguments (for no reason; it works fine without the quotes) is not supported. This is WAD; I decided long ago that this particular unnecessary syntax would create problems with supporting otherwise valid command lines.
 
Aug 16, 2008
124
0
I'm running TCC v15.01.52 and I get expected behavior.
Code:
TCC: Not an alias "where"

Try running your command without the quotes:
Code:
tcc /c alias where

It's possible that the version of TCC you are running is trying to run "alias where" as opposed to ALIAS with an argument of "where".
-Scott

I don't run the command in quotes. That's FAR functionality. And it works without the plugin.
 
Aug 16, 2008
124
0
Actually, TCC does emulate most of the (bizarro) CMD behavior with multiple quotes (mostly in the wrong places) on the startup command line. This one particularly twisted syntax of quoting part of the command line and arguments (for no reason; it works fine without the quotes) is not supported. This is WAD; I decided long ago that this particular unnecessary syntax would create problems with supporting otherwise valid command lines.

Is there any particular reason, why 'tcc /c "alias whatever"' works from a Take Command terminal but not when run via the Windows run dialogue? It also baffles me that 'tcc /k "alias whatever"' works (but not /c).
 
May 20, 2008
11,411
99
Syracuse, NY, USA
Is there any particular reason, why 'tcc /c "alias whatever"' works from a Take Command terminal but not when run via the Windows run dialogue? It also baffles me that 'tcc /k "alias whatever"' works (but not /c).
That would depend on how and when you load your aliases. If they're always loaded (SHRALIAS is running and you use global aliases) or you *always* load them in TCSTART.BTM, both should work. If you exit TCSTART.BTM before loading aliases in transient (/C) instances then I'd expect the behavior you mention.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Loading of aliases ought not to be relevant. As Scott showed, if the TCC command alias is executed at all, it would display either the Not an alias "where" error message, or expand the alias, instead of the actual error report indicating the quote marks having caused a syntax error: the whole command line being considered to be the command itself. I would think that this would cause havoc with externals (other executables) expecting parameters. Without having either ConEmu or the FAR plugin I cannot perform meaningful tests...
 
May 20, 2008
11,411
99
Syracuse, NY, USA
I misunderstood his question. I do not see a difference. From the run dialog, both
Code:
TCC /K "alias whatever"

and
Code:
TCC /C "alias whatever"
result in
Code:
TCC: Not an alias "whatever"
Occasionally, in the second case, the console disappears so quickly that I don't see the output. It's easier to see if I
Code:
TCC /C "alias whatever" & pause
 
Similar threads
Thread starter Title Forum Replies Date
L TCC V22 installer fails signature validation Support 0
S WAD KEYSTACK fails in TCC-64 Support 2
dcantor WAD dir "ftp:// ..." fails in TCC 15 Support 7
Juanma Barranquero list /c fails for attached TCC on TCMD 11 x64 Support 0
R 4NT, TCC/LE : "IF EXIST X:\NUL" always fails Support 13
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
C COMSPEC constantly reset to TCC.EXE Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
C How to? starting TCC/TCMD v25 Support 2
CWBillow TCC and TCMD in Powershell Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.24 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.23 uploaded Support 0
Alpengreis Fixed Crash after copy dialog with big TCC.exception.log Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT v27.01 Build 22 Uploaded Support 0
L FTYPE in TCC, less quirky than in cmd.exe Support 3
V Set path permanently from within TCC? Support 3
DrusTheAxe Runaway TCC.exception.log filling drive Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.21 uploaded Support 0
Joe Caverly tcc.exception.log Support 3
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.20 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.19 Support 0
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
vefatica SCRIPT ... TCC disappears Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT v27.0.18 Support 0
Jesse Heines Access Denied errors in TCC 27 Support 9
fpefpe How to? tcc inifile (%_ininame) Support 3
M How to? Black TCC Prompt Support 2
D Differences between TCC and CMD with COPY /b Support 4
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
Jay Sage Extra TCC Tasks Support 6
vefatica Can I turn off the minimize to tray mechanism in TCC? Support 5
N Command execution slows down in TCC Prompt after a while Support 6
R Upgrade TCMD 19 to TCC 26 Support 1
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
samintz How to? Is this doable in TCC? Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 26.02.41 Uploaded Support 0
D TCC tab detaching & restarting Support 3
Ó Recent git output not shown on TCC Support 1
P Kill all other instances of tcc from a btm batch file Support 2
L Using TCC.exe through an SSH connection Support 3
M TCC color issue in ConEmu Support 4
Alpengreis UTF-8 problem in TCC related to Python Support 7
Alpengreis Python support for 3.8.3 in TCC v26.x? Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 26.01.40 uploaded Support 0
Peter Murschall TCC V26.01.3x Debugging has problems with Alias /R Support 1
rconn News Take Command / TCC / CMDebug / TCC-RT 26.0.37 Uploaded Support 0
vefatica TCC waits for Office apps Support 4
Joe Caverly .BAT works in TCC-RT 25, but not in TCC-RT 26 Support 4
M Strange error messages from TCC in FTP copy Support 7
Kachupp Documentation tcc-rt versions Support 1

Similar threads