You click "Cancel" on a print job. Windows says "Deleting...". Ten minutes later it still says "Deleting...", and every document sent after it is stuck behind it.
If you've done IT support for family, friends or an office, you've seen this one. Restarting the PC usually works, but there's a faster and more reliable fix you can script once and reuse forever.
Why the queue gets stuck
Windows doesn't send your document straight to the printer. The Print Spooler service (Spooler) first writes each job to disk as a pair of files:
- a
.SPLfile (the actual print data) - a
.SHDfile (shadow file with job metadata)
They live in:
C:\Windows\System32\spool\PRINTERS
When a job gets corrupted, or the printer drops off the network mid-job, the spooler can hang on to those files and refuse to let go. The UI keeps saying "Deleting" because the service itself is the thing that's stuck.
Option 1: the polite way
Before reaching for the hammer, try removing jobs through the print cmdlets (built into Windows 8 / Server 2012 and later):
# See what's in every queue
Get-Printer | ForEach-Object { Get-PrintJob -PrinterName $_.Name }
# Remove all jobs from one printer
Get-PrintJob -PrinterName "Office Printer" | Remove-PrintJob
If that clears it, you're done. If the job is still there (or the command hangs), move on.
Option 2: reset the spooler and purge the folder
This is the fix that works almost every time. Save it as Clear-PrintQueue.ps1:
#Requires -RunAsAdministrator
$spoolDir = Join-Path $env:SystemRoot "System32\spool\PRINTERS"
Write-Host "Stopping Print Spooler..." -ForegroundColor Yellow
Stop-Service -Name Spooler -Force
Write-Host "Removing stuck jobs from $spoolDir"
Get-ChildItem -Path $spoolDir -File -ErrorAction SilentlyContinue |
Remove-Item -Force -ErrorAction SilentlyContinue
Write-Host "Starting Print Spooler..." -ForegroundColor Yellow
Start-Service -Name Spooler
Get-Service -Name Spooler | Select-Object Name, Status
What it does, step by step:
-
Stops the spooler so it releases its lock on the job files.
-Forcealso stops services that depend on it. - Deletes everything in the spool folder. Only files, never the folder itself.
- Restarts the spooler with an empty queue.
-
Prints the service status so you can confirm it's
Running.
The #Requires -RunAsAdministrator line makes PowerShell refuse to run the script without elevation, instead of failing halfway with "Access denied".
Making it one-click
For non-technical users, wrap it in a shortcut. Create a shortcut with this target:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\Scripts\Clear-PrintQueue.ps1"
Then in the shortcut's Properties > Advanced, tick Run as administrator. Now "the printer is stuck" becomes a double-click.
Things to keep in mind
- It clears every queue, for every printer. Anything waiting to print will be lost and needs to be sent again.
-
If the spooler won't stay running, the problem isn't the queue: it's usually a broken printer driver. Check the System log in Event Viewer for
PrintServiceerrors. - On shared print servers, warn people first. Restarting the spooler there interrupts everyone's jobs.
- The classic CMD equivalent, if PowerShell isn't an option:
net stop spooler
del /Q /F %systemroot%\System32\spool\PRINTERS\*.*
net start spooler
Wrapping up
Ten lines of PowerShell, and one of the most common "my computer is broken" calls disappears. If you manage several machines, the same script works fine through Invoke-Command or your RMM tool.
What's your go-to script for printer problems? Share it in the comments.
Top comments (0)