To use a network printer in a DOS program, you must issue a:
NET USE LPTx: \\ComputerName\PrinterShare.
In tip 0672, we learned that the default printer information is located at:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device
Using REGFree, we can add either of the following to a logon script:
for /f "Tokens=1-5 Delims=,: " %%i in ('reg -listvalue "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"') do set prt=%%j&set port=%%l net use %port%: %prt%OR
for /f "Tokens=2 Delims=, " %%i in ('reg -listvalue "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"') do set prt=%%i net use LPT1: %prt%
0 comments
Hide comments