Clear print queue command line sequence

Last Updated on December 20, 2022 by Dave Farquhar

Here’s an old, old, but still useful tip that works on all NT-based versions of Windows, including Windows 10 and Windows 11. This is the clear print queue command line sequence for Windows, and it’s the fastest, most reliable way to recover from a hung print job. It works from the standard Windows CMD prompt.

The sequence is to stop the spooler service, delete the contents of the spooler directory (usually c:\windows\system32\spool\printers\) and then restart the spooler service.

The clear print queue command line sequence

clear print queue command line sequence
If your printer won’t print because some job is stuck in the print queue, you need my magic 3-command clear print queue command line sequence.

Open a command prompt (CMD.EXE) as administrator. Then issue these three commands:

net stop spooler
del /q c:\windows\system32\spool\printers\*
net start spooler

If you have your printers folder open while you issue this command sequence, you’ll see your stuck print jobs disappear, like magic.

If you’ve moved your print spooler to a ramdisk, like I once recommended, or to another drive like some government agencies do, substitute that directory for c:\windows\system32\spool\printers in the second line.

And if you’re wondering, this works both for physical printers and for virtual printers like Microsoft Print to PDF.

How it works

The spooler service locks the content of the spooler directory, keeping you from deleting the files. When you stop the service, you can safely delete the files. Stopping the service, deleting the files, and restarting the service is much faster than the method Windows uses through the GUI.

The downside is it deletes every job in the queue, rather than individual jobs. But sometimes clearing the whole queue quickly is what you want, especially if you don’t know for certain which job is hanging you up. Or if there’s only one job and you want to clear it fast.

One more tip

When you have a print job that’s stuck and keeping you from using your printer, this clear print queue command line sequence will get rid of it more reliably than any other method. It’s fast. It’s also much faster than right-clicking on a hung print job and then waiting for it to finally disappear. I’ve seen it take 15 minutes in the GUI, versus 15 seconds from the command line. If you print really large, complex jobs, you may find yourself doing this a lot. If that’s the case, you might want to save it as a batch file and keep it someplace handy. It will help you get back to work quickly.

Further reading

I’ve collected most of my scripting resources in a single post about scripting Windows sysadmin tasks.

If you found this post informative or helpful, please share it!