You can fix that by redirecting error output of the command. For instance, in a dir where no tmp files exist: dir *.tmp >nul 2>&1 In English this command means, "Redirect output of the DIR command to the NUL handle, as well as redirect error output (specified by 2>) to STDOUT (&1)." Since STDOUT is alredy being routed to NUL so will STDERR.