@echo on Title LPT Printer Reset Utility - KUtils REM Set base variables set ComD=net use set port=LPT1 echo Fetching Printer Share Data... REM check for LPT2 %ComD% LPT2 && set port=LPT2 for /f "tokens=1*" %%a in ('net use ^| find "%port%" ') do ( set share=%%b) set share=%share:~10% set ComR=%ComD% %port% %share% echo Deleting Connection Data... %ComD% %port% /DELETE echo Resetting Connection... %ComR% && goto SUCCESS goto FAILURE :SUCCESS echo Connection Reset Successfully! echo. echo Press any key to exit... pause > nul exit :FAILURE title ERROR! echo. echo There was an error in processing echo your network printer settings. echo. echo If this is the first error of echo this type, try running the echo utility again. echo. echo Press any key to exit... pause > nul exit