Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
October 14, 2001
A. Reader Daniel Wolf sent in the following Kixtart script that maps the current user's default printer to LPT1 (assuming the default printer is a network printer). To run the script, go to the command line and type
kix32.exe printer.scr
Kixtart is part of the Windows 2000 Server Resource Kit, Win2K Pro Resource Kit, Windows NT 4.0 Server Resource Kit, and NT 4.0 Workstation Resource Kit.
--- printer.scr start (Kix Script) --- ; read Default Printer Server and Sharename from Windows Registry ; and map to LPT1 (Windows 2000 and Windows NT only; not tested on ; Windows XP) ; by Daniel Wolf ; [email protected] $Printer = READVALUE("HKEY_CURRENT_USERSoftwareMicrosoftWindows NTCurrentVersionWindows","Device"); $Index = 1 WHILE $Index < LEN($Printer) $Testchar = SUBSTR($Printer, $Index, 1) IF $Testchar = ',' $Cutat = $Index - 1 $Index = LEN($Printer) ENDIF $Index = $Index + 1 LOOP $Printer = SUBSTR($Printer, 1, $Cutat) $Checklocal = SUBSTR($Printer, 1, 2) ? "Default Printer: $Printer" ; only map if Default Printer is Network Printer IF $Checklocal = "\" ? "Removing existing LPT1 mapping ..." USE LPT1 /D USE LPT1 $Printer IF @ERROR BEEP ? "Error @ERROR mapping $Printer to LPT1" ELSE ? "Done. $Printer mapped to LPT1" ENDIF ELSE ? "ABORT. Default Printer is not a network printer!" ENDIF --- printer.scr end ---
You May Also Like