Вы находитесь на странице: 1из 1


@Set SpoolerDir="%comspec:cmd.exe=%spool\printers"

@>nul 2>nul dir /a-d "%SpoolerDir%\*" && (goto CheckPrivileges)
@Echo No file(s) found in Spooler Print directory :
@Echo %SpoolerDir%
@goto Halt

@Rem Check user has elevated admin privileges by forcing condition test.
@if '%errorlevel%'=='0' goto AllOk
@Echo Batch file must be run as Administrator
@Echo to allow Spooler Service to Reset.
@goto Halt

@Rem @Echo Deleting all Print Files in :
@Rem @Echo %SpoolerDir%
@Rem Remove unwanted DIR headings.
@echo --- Date ---- Time -------------- Size ---- Owner -------------- File Name ---
@FOR /f "tokens=*" %%D IN ('dir /q /a-d %spoolerdir%\*.* ^| find "/"') DO echo %%D

@Net stop spooler
@Del /F /Q %SpoolerDir%\*.*
@Echo All Spooler Print files deleted....
@Net start spooler

@Rem Show if any corrupt files still remaining in Spooler directory.
@>nul 2>nul dir /a-d "%SpoolerDir%\*" || (goto Halt)
@Echo Files Still Remaining in Spooler Directory :
@Echo -------------------------------------------
@Dir %SpoolerDir% /b