2

When you attempt to start the TCC/LE console via executing TCC.exe from ConEmu alongside the cmdInit.cmd script, you get this error:

TCC: C:\[...]\ConEmu\cmdInit.cmd [8] Unknown command "C:\WINDOWS\system32\find.exe Windows"

How do you prevent this error and fix any issues related to initializing the ConEmu prompt from TCC/LE?

1 Answer 1

4

The Unknown Command Error

That error is related to this line of the ConEmu cmdInit.cmd:

cmd /d /c ver | "%windir%\system32\find.exe" "Windows"

TCC/LE is mangling the command, and actually ends up executing this:

cmd /d /c ver | "%windir%\system32\find.exe Windows"

That modified version is an invalid command, and that is why we get an error. Fixing this is as easy as making TCC/LE aware that we don't want it to "helpfully" auto-concatenate our strings using the following replacement command:

cmd /d /c ver | %@QUOTE[%windir%\system32\find.exe] "Windows"

This fix uses the @QUOTE command to add double quotes to the file path only if needed. In a standard installation of Windows there will not be any spaces in the path to find.exe, so now we don't need the quotes and TCC/LE won't ruin our command by combining things.


Incorrect Windows Version Information

Unfortunately for the pickier people like myself, there is an additional problem on Windows 10 with the default TCC/LE prompt. TCC/LE thinks that all Windows version strings begin with "6.3." (I believe older Windows versions used to be versioned this way), leading it to print the following initial prompt once you fix the above error:

TCC LE  14.00.9 x64   Windows 10 [Version 6.3.17763]
Copyright 2016 JP Software Inc.  All Rights Reserved

Microsoft Windows [Version 10.0.17763.346]

emily@EMILY-LAPTOP C:\Users\emily
$

I find this printing of two different Windows versions for the same machine to be extremely annoying, so I developed an additional fix for this bug that makes additional modifications to the cmdInit.cmd script. That fix is to replace the fixed version of the default command with this more extensively modified command:

cls &^
echos TCC LE  %_4VER%.%_BUILD% %@IF["%_X64%" == "1",x64,x86]`   `&^
cmd /d /c ver | %@QUOTE[%windir%\system32\find.exe] "Windows"

This command erases the original incorrect prompt before replacing it with a prompt that includes the TCC/LE version information (using TCC/LE internal variables) as well as the correct windows version. Additionally, the fixed version continues to correctly print out the processor architecture (x86 or x64) and includes the same lopsided spacing as the original (there are two spaces before and after 14.00.9 x64, but there is an additional space afterwards, leading to 2 spaces before and 3 spaces after). The fixed version with support for Windows 10 prints the following output when run (your machine's specific versions and processor arch may differ):

TCC LE  14.00.9 x64   Microsoft Windows [Version 10.0.17763.346]

emily@EMILY-LAPTOP C:\Users\emily
$ 

Drop-in Fix

Here is a final copy/paste version of the fix with comments which you can use use as a copy/paste drop-in:

rem Simple "ver" prints empty line before Windows version
rem Use this construction to print just a version info
rem cmd /d /c ver | "%windir%\system32\find.exe" "Windows"

rem This is a fixed version of the original version printout for TCC/LE
rem cmd /d /c ver | %@QUOTE[%windir%\system32\find.exe] "Windows"

rem This is a fully fixed version which prints out the correct 
rem version string for the Windows installation
cls & echos TCC LE  %_4VER%.%_BUILD% %@IF["%_X64%" == "1",x64,x86]`   `& cmd /d /c ver | %@QUOTE[%windir%\system32\find.exe] "Windows"

Remember to make a copy of cmdInit.cmd (perhaps cmdInitTCC.cmd), point your ConEmu tasks for TCC/LE at the edited copy of cmdInit.cmd. If you edit cmdInit.cmd directly, the next time you update ConEmu it will clobber your modifications (there is a warning at the top of the script). I am using this following command to start TCC/LE from ConEmu using a copy named cmdInitTCC.cmd: %ConEmuDrive%\Programming\Links\tcc_le-x64\tcc.exe /k %ConEmuBaseDir%\cmdInitTCC.cmd" -new_console:d:%USERPROFILE%

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .