Tuesday, August 31, 2010

Automatically Print NT Backup Logs - Revised

A serious shortcoming of today's printers is an inability to print output from MS-DOS (or is it a Windows shortcoming?)  One way around this is the wordpad /pt [filename] [printer] command.  Here's a revised PRTBAKLOG.bat file that will print the last NT Backup Log file to the specified printer.

@echo off
setlocal
if {%1}=={} @echo Syntax PrintDevice (\\Server\Printer)
set device=%1
set prt=N
for /f "Tokens=*" %%i in ('dir /o-d /b "%userprofile%\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\backup*.log"') do call :print %%i
endlocal
goto :EOF
:print
if not "%prt%" EQU "N" goto :EOF
set prt=Y
"C:\Program Files\Windows NT\Accessories\wordpad.exe" /pt "%userprofile%\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\%1" %device%

There is also a notepad /p [filename] OR wordpad /p [filename] to send output to the default printer should you need it.

No comments: