TCC and CMD Compatibility
We try to keep TCC as compatible as possible with CMD, given the limitations and bugs in CMD, the variances in CMD in different versions of Windows, and the thousands of additional features provided in TCC. On rare occasions, you may find batch files that exploit undocumented features or bugs in CMD (or are simply badly written) that don't work in TCC. In almost all of those cases, TCC will run those batch files if you set the appropriate compatibility options.
If you want to write batch files that are compatible with CMD, you will need to:
- In the batch debugger, click on the Options menu and select "CMD Syntax". This will turn on some CMD compatibility flags (including to duplicate some CMD bugs), and change the syntax coloring to only recognize CMD commands.
- Make sure you are not using any of the extended TCC options for the CMD commands (i.e., COPY, DIR, REN, etc.).
There are two options you should set if you regularly run batch files created for CMD:
OPTION / Startup / Duplicate CMD.EXE bugs (This is the default, and tells TCC to duplicate two bugs in CMD's IF command parsing.)
OPTION / Startup / CMD.EXE delayed expansion (If you have this startup option set for your CMD environment.)
If you only run batch files created for CMD (with variable names with a preceding and trailing %), you should also set:
in your TCMD.INI file. WARNING: This means you won't be able to run any batch files written for TCC, which only requires a single leading % for variables.
There are also some TCC features that might on very rare occasions cause conflicts with CMD batch files:
Enable "OPTION / Startup / Search for SFNs". (Definitely not recommended unless you want some potentially unpleasant results when you're copying, moving, or deleting files, but it *is* how CMD does it.)
Disable pseudovariable expansion (OPTION / Advanced / Special Characters).
SETDOS /X279 to disable nested aliases, quoting, and include lists.
Finally, if you want CMD-style command line editing (i.e., practically none), you can remove most of the TCC command line editing features with the OPTION / Command Line dialog.