The variable _LOGFILE is not returning the name of the log file: TCC(17.00.55): C:\tcmd>log /h /w c:\tcmd\cmd_log.txt TCC(17.00.55): C:\tcmd>echo Log file: %_logfile Log file: In fact, commands are being logged to the specified file.