Special syntax for CMD compatibility

For compatibility with CMD, TCC-RT supports additional syntax to qualify references to parameters of batch files and the control variable of the FOR command when referenced by the command it executes. However, this syntax can usually be replaced by more flexible Variable Functions.


CMD syntax

Expands to

Suggested replacement


All parameters



unquoted (")



Fully qualified name of %n



Drive letter portion of %n



Full path (no drive letter) of %n



Root name (no extension) of %n



File extension of %n



Fully qualified short name of %n



File attributes of %n



File date and time of %n

%@filedate[%n] %@filetime[%n]


File size of %n, bytes



Full name of the first match for %n in %PATH





In the special case where the parameter to a %~ variable is 0, e.g., %~f0, the returned file name will always include the extension, as it does under CMD.


%~$PATH:n returns an empty string if the file %n is not found in the path.


References qualified by the tilde ~ trigger an error message when used improperly, e.g. if attempting to display the size of a string parameter which is not the name of a file.