Created
May 22, 2012 10:32
-
-
Save jeffory/2768207 to your computer and use it in GitHub Desktop.
Printer Reset Batch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
goto skiphelp | |
:help | |
echo Printer Reset Script Usage | |
echo(by Keith McGahey ^<jeffory@c0d.in^> | |
echo/ | |
echo( /? - display this help | |
echo( /f - force script to run, skipping confirmation question | |
goto end | |
:skiphelp | |
rem Check arguments for switches... | |
:Loop | |
if "%1"=="" GOTO Continue | |
if "%1"=="/f" ( | |
goto skipconfirm | |
) | |
if "%1"=="/?" ( | |
goto help | |
) | |
shift | |
goto Loop | |
:Continue | |
echo Restart printers/clear print queue? (y/n) | |
set /p confirm= | |
if "%confirm%"=="y" ( | |
:skipconfirm | |
echo Stopping spooler... | |
net stop spooler | |
echo Deleting print jobs... | |
del "%systemroot%\system32\spool\printers\*.shd" | |
del "%systemroot%\system32\spool\printers\*.spl" | |
echo Starting spooler... | |
net start spooler | |
goto end | |
) | |
echo Canceled. | |
:end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment