JSI Tip 5696. How do I add additional LPT ports on Windows .NET Server, Windows 2000, and Windows XP?

The subject operating systems have LPT1, LPT2, and LPT3 available by default.

You can add additional LPT ports, from LPT4 though LPT9. These new ports will be available in the Add Printer Wizard.

I have scripted AddLPT.bat to make adding of these ports easier.

The syntax for using AddLPT.bat is:

AddLPT from to

where From is the starting port number and To is the ending port number.

Examples:

AddLPT 4 9

AddLPT 4 5

If you previously used AddLPT 4 5, you can now issue
AddLPT 6 9.

AddLPT.bat contains:

@echo off
setlocal
if \{%2\}==\{\} goto syntax
if "%1" LSS "4" goto syntax
if "%2" GTR "9" goto syntax
set from=%1
set to=%2
@echo REGEDIT4>%temp%\LPT.REG
@echo.>>%temp%\LPT.REG
@echo \[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports\]>>%temp%\LPT.REG
for /l %%i in (%from%,1,%to%) do @echo "LPT%%i:"="">>%temp%\LPT.REG
@echo.>>%temp%\LPT.REG
regedit /s %temp%\LPT.REG
net stop spooler
net start spooler
endlocal
goto :EOF
:syntax
@echo Syntax:  AddLPT from to   
@echo Example: AddLPT 4 9
endlocal


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish