Advertisement
kyle_engineer

LPT Port Reset

Oct 23rd, 2013
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.38 KB | None | 0 0
  1. @echo on
  2. Title LPT Printer Reset Utility - KUtils
  3. REM Set base variables
  4. set ComD=net use
  5. set port=LPT1
  6. echo Fetching Printer Share Data...
  7. REM check for LPT2
  8. %ComD% LPT2 && set port=LPT2
  9.  
  10. for /f "tokens=1*" %%a in ('net use ^| find "%port%" ') do ( set share=%%b)
  11. set share=%share:~10%
  12. set ComR=%ComD% %port% %share%
  13. echo Deleting Connection Data...
  14. %ComD% %port% /DELETE
  15. echo Resetting Connection...
  16. %ComR% && goto SUCCESS
  17. goto FAILURE
  18.  
  19. :SUCCESS
  20. echo Connection Reset Successfully!
  21. echo.
  22. echo Press any key to exit...
  23. pause > nul
  24. exit
  25.  
  26. :FAILURE
  27. title ERROR!
  28. echo.
  29. echo There was an error in processing
  30. echo your network printer settings.
  31. echo.
  32. echo If this is the first error of
  33. echo this type, try running the
  34. echo utility again.
  35. echo.
  36. echo Press any key to exit...
  37. pause > nul
  38. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement