-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathclear_stuck_print_jobs.bat
37 lines (32 loc) · 1.15 KB
/
clear_stuck_print_jobs.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
:: Purpose: Flushes the Windows printer queue when it's full and stuck
:: Requirements: Must run as administrator
:: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2
:: Version: 1.0.1 * Reworked CUR_DATE variable to handle more than one Date/Time format
:: Can now handle all Windows date formats
:: 1.0.0 Initial write
::::::::::
:: Prep :: -- Don't change anything in this section
::::::::::
@echo off
set SCRIPT_VERSION=1.0.1
set SCRIPT_UPDATED=2014-01-27
:: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it
FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a
set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2%
cls
:::::::::::::::
:: VARIABLES :: -- Set these to your desired values
:::::::::::::::
:: No user-set variables in this script
:::::::::::::::
:: Execution ::
:::::::::::::::
echo Stopping print spooler.
echo.
net stop spooler
echo Deleting old print jobs...
echo.
FOR %%i IN (%systemroot%\system32\spool\printers\*.*) DO DEL %%i
echo Starting print spooler.
echo.
net start spooler