TR [/C] [/D] [/S] set1 [set2]
A filter that copies input to output, replacing each character in set1 with the matching character in set2; if set2 is shorter, its last character repeats. TR doesn’t accept file names, so its input must come from a pipe or a redirected file (eg, TR a-z A-Z < NAMES.TXT).
/C uses every character not in set1 (in ascending order)/D deletes the characters in set1, instead of replacing them/S squeezes each run of a character in the last set given into a single characterA set can contain ranges (eg, a-z) and these escapes:
\t for TAB\n for LF\r for CR\ before any other character for that character (eg, \- or \\)A set that contains spaces, or starts with the switch character and a letter, must be quoted.
DIR | TR a-z A-Z
TYPE README.TXT | TR /D \r
DIR | TR /S " "
ERRORLEVEL is set to 0, or 2 if a switch isn’t valid or a set is missing (or only set1 is given, without /D or /S), which TR reports (Syntax error).
Source: tr.asm
Copyright (c) 2020-2026 Jeff Parsons Released under MIT License