Remove Stuck Jobs from the Printer Queue

Did you ever had a job on your printer queue that just couldn’t be deleted? I find that this happens quite frequently with shared network printers on Windows networks. This stuff can be a pain in the ass, so here is how to deal with these kind of situations. You have to manually clean out the spool folder.

This should be a common knowledge thing, but surprisingly few people know about this so I’m posting it here. This way I can just send this link to people who are having this issue instead of explaining the whole thing from the begging. So if this post is not as condescending toward technological incompetence as usual it’s because I’m kinda targeting this at the lost and clueless. :mrgreen:

First things first, you will need to do this on the computer which is sharing the printers to the rest of the network. It’s usually going to be the computer to which the printer is attached, or the local File & Printer sharing server. If you do this on the wrong computer it won’t work.

Once you locate the machine that handles the printer sharing, you need to stop the print spooling service. Otherwise we won’t be able to clean out the hanging jobs. This is the service that accepts printing jobs, queues them up, and sends them to the printer. Note that once you stop this service no one on your network will be able to print to the printer in question. Of course since you have a stuck job in there, no one can print anyway so it should not be a big issue. Also note that you will loose all queued jobs if you do this. Here is how you do this:

Pull up your Run box (Windows Key+R) type in cmd and hit Enter. This will bring you to the MS DOS prompt. There type in the following:

net stop spooler

You should get a message saying the spooler stopped successfully. Now we need to clean out the spool folder. This is where windows keeps jobs that haven’t been printed yet.

Call up your Run box again (Windows Key+R) and type in the following:

%SYSTEMROOT%\system32\spool\PRINTERS

This should open a new explorer window. You are likely to see bunch of files in there – some of which may be classified as “Shockwave Objects” by windows. They are actually not Shockwave files but whatever. We don’t care because we will be deleting them. Just remove everything you can see that folder and then close the window. If you can’t delete some of the files, it means that you didn’t stop the spooler properly. Go back and try it again.

This deletes all the jobs on the queue, so you might need to re-send some of the documents that got stuck there waiting. Once the folder is empty go back to your DOS prompt and type in:

net start spooler

Your printer queue should be clean now. If it’s not, you probably did something wrong.

Please note that if you look in your Printers and Faxes folder before you issue the start spooler command you will find that all your printers are missing. Don’t panic – this is normal. They will come back once you start the spooler service.

Alternatively you can use the following batch script:

@echo off
net stop spooler
del /F %SYSTEMROOT%\system32\spool\PRINTERS\*.*
net start spooler

Copy the lines above, paste them into notepad and save it as a .bat or .cmd file. Then just double click to run it when your printer gets stuck.

Update 04/02/2007 08:51:47 PM

Updated the script as per suggestion from Daniel Montero (see the comments).

Update 07/30/2011

If you don’t want to deal with the command line stuff, I actually created a nifty little graphical utility that will execute all of this stuff for you. You can get it from here and it looks like this:

Fix My Printer Screenshot

This entry was posted in sysadmin notes and tagged , . Bookmark the permalink.



45 Responses to Remove Stuck Jobs from the Printer Queue

  1. Daniel Montero MEXICO Mozilla Firefox Windows says:

    You should use
    del /F %SYSTEMROOT%\system32\spool\PRINTERS\ *.*
    instead of
    cd %SYSTEMROOT%\system32\spool\PRINTERS
    del /F *.*

    , as if the CD command doesn’t work (eg. current drive D: and System Drive C:), the DEL command that follows would remove your documents !

    Reply  |  Quote
  2. Luke UNITED STATES Mozilla Firefox Windows says:

    Thanks! That’s a very good point.

    I updated the script.

    Reply  |  Quote
  3. B UNITED STATES Mozilla Firefox Windows says:

    Excellent post, it helped a lot, works like a charm!

    My English grade thanks you.

    Reply  |  Quote
  4. Luke UNITED STATES Mozilla Firefox SuSE Linux says:

    Glad I could help B. :)

    Reply  |  Quote
  5. Michael AUSTRALIA Internet Explorer Windows says:

    Or if your too lazy to login to the print server
    Note: You need the resourse kit installed locally and must be a domain admin.

    @echo off
    sc \\ stop spooler
    del /F /Q \\\c$\windows\system32\spool\PRINTERS\*.*
    sc \\ start spooler

    Note: /Q suppresses the delete y/n prompt

    Reply  |  Quote
  6. Luke UNITED STATES Mozilla Firefox Ubuntu Linux says:

    Great tip Michael! Thanks!

    Reply  |  Quote
  7. Michael AUSTRALIA Internet Explorer Windows says:

    *my first post is incorrect….doesnt show the servername, here is the correct syntax*

    Or if your too lazy to login to the print server
    Note: You need the resourse kit installed locally and must be a domain admin.

    @echo off
    sc \\servername stop spooler
    del /F /Q \\servername\c$\windows\system32\spool\PRINTERS\*.*
    sc \\servername start spooler

    Note: /Q suppresses the delete y/n prompt

    Reply  |  Quote
  8. Luke UNITED STATES Mozilla Firefox Windows says:

    Heh.. Yeah, I just noticed this. I initially just eyeballed it and saw familiar syntax so I posted a thank-you reply. :)

    Reply  |  Quote
  9. Steve UNITED STATES Mozilla Firefox Windows says:

    Where are these files coming from? I cleaned out the spooler folder last night and this morning it had filled back up with the same type file. Nothing that was sent to the spooler by me. So far only one machine seems to be affected. There must be malware that creates them. I have run spybot and ad-aware in addition to Norton Anti virus with no apparent villian.

    Reply  |  Quote
  10. Luke UNITED STATES Mozilla Firefox Ubuntu Linux says:

    I think these files are generated by the spooler during normal activity. You shouldn’t worry about them unless you seem to have stuck jobs on the queue.

    I haven’t heard of any spyware that would jam your printer queue. It doesn’t mean that one does not exist, but it’s more likely it is a network issue (maybe a client is dropping off the wireless in the middle of transmitting a job or something).

    Reply  |  Quote
  11. Steve UNITED STATES Mozilla Firefox Windows says:

    First off, the spool service was tying up the CPU when there were no print jobs in the queue nor any recent print activity. One of the affected machines is rarely used to print anything so I am somewhat skeptical that these were legitimately generated by a print command from one of the programs.

    I can rule out dropped signals from wireless as wireless is disabled on all machines. Since the C:\WINDOWS\system32\spool folder is used as a reservoir from which to disseminate printing instruction, I would think that it is unlikely that it would be used by any other machine on the network, though I admit that within the network my security policy on shared folders is very liberal. The Spool folder is not shared. I did recently block spoolsv from accessing the internet in case another program was trying to use it .
    Other than something from my new bidirectional print server or some still operable sub-routine remaining on the two drives that were once C drives, I am at a loss as to the source of the files. After three cleanouts of the spool\PRINTERS folder, the file has remained clean for 3 days but no re-boots. I am keeping my fingers crossed.

    I should add two things: First I am grateful to find the advice here as I had found lots of people with the same problem but no one else with the answer. It was obvious this fix was correct, I wonder that I didn’t think of it myself.
    Two, the batch files and run commands offered seem unnecessarily complex. For all but the geeks among us, it is simpler and perhaps safer to use Administrative Tools>Component Services>Services (Local) to access the Spoolsv process to stop the service and simply navigate to WINDOWS\System32\Spool\PRINTERS and delete all the files there, then restart the service. Most users can easily do this if they have turned on the ‘Show Hidden Files’ option in the View tab under Tools> Folder Options..

    Reply  |  Quote
  12. Luke UNITED STATES Mozilla Firefox Windows says:

    I had some problems with an HP printer software causing 100% CPU usage before. Check out that thread – maybe it applies to your problem too.

    [quote comment="4239"]For all but the geeks among us, it is simpler and perhaps safer to use Administrative Tools>Component Services>Services (Local) to access the Spoolsv process to stop the service and simply navigate to WINDOWS\System32\Spool\PRINTERS and delete all the files there, then restart the service.[/quote]

    Yes and no. A “double click this icon and wait till it finishes” is sometimes simpler. It all depends on user. Some people I work with would be terrified touching the services.msc console to disable the spooler – but would happily run a script that does this for them.

    Also, being a geek myself, I like batch scripts. :mrgreen:

    Reply  |  Quote
  13. Michael AUSTRALIA Internet Explorer Windows says:

    Yeah!….Go the Scripts!….Yeah!

    Reply  |  Quote
  14. Dheeren Mozilla Firefox Windows says:

    Excellent post, thanks alot

    Reply  |  Quote
  15. Nemea UNITED STATES Mozilla Firefox Windows says:

    Hello!

    I tried this suggestion, and when I get to the folder there are no files to delete. However, when I mouseover the icon in the system tray it still says there is a document pending. Garg!

    Reply  |  Quote
  16. Luke UNITED STATES Mozilla Firefox Windows says:

    [quote comment="4349"]I tried this suggestion, and when I get to the folder there are no files to delete. However, when I mouseover the icon in the system tray it still says there is a document pending. Garg![/quote]

    The job might have been spooled by another computer. Make sure you are at the computer that is sharing out the printers to the network.

    Reply  |  Quote
  17. Michael AUSTRALIA Internet Explorer Windows says:

    Hey! Thought to add this….
    I had this issue from time to time on a certain printer – the printer was setup on a win2k server – where user connect to it.
    Now this problem was resolved by referencing this great post, but since then I determined a cause (note: this would not apply to all cases outlined, but did to me!)
    The cause was a corrupt printer driver.
    I uninstalled and rebooted, downloaded the same version driver again, setup the printer/queue/share/printing defaults etc again and have not had any issues since.
    This has fixed my issue with blocked queues etc.
    Well worth consideration!

    Reply  |  Quote
  18. Luke UNITED STATES Mozilla Firefox Windows says:

    [quote comment="4351"]The cause was a corrupt printer driver.
    I uninstalled and rebooted, downloaded the same version driver again, setup the printer/queue/share/printing defaults etc again and have not had any issues since.[/quote]

    Thanks. It is a very good point – if this sort of thing happens regularly, it is probably a good idea to reinstall the driver on the server, and all the network clients.

    Reply  |  Quote
  19. Shawn Wilson CANADA Mozilla Firefox Windows says:

    Thank-you, noble blogger! That stuck job was pissing me off.

    Reply  |  Quote
  20. Nomi SPAIN Mozilla Firefox Windows says:

    I saved ran the script above from my desktop and it actually deleted everything on my desktop except my folders, which really sucks. Just a warning.

    Reply  |  Quote
  21. Luke UNITED STATES Mozilla Firefox Ubuntu Linux says:

    Nomi – make sure that there is no space before *.* in the command:

    del /F %SYSTEMROOT%\system32\spool\PRINTERS\*.*

    I just noticed that for some reason I put a space there and this is indeed what would happen – it would delete stuff in the current folder. I fixed the line in the post so it should be ok to copy and paste it now.

    Sorry for the trouble, and thanks for catching this!

    Reply  |  Quote
  22. Dr.Feelin UNITED STATES Mozilla Firefox Windows says:

    Thank you so much for the help.

    Reply  |  Quote
  23. Philip UNITED STATES Internet Explorer Windows says:

    Great post. Worked like a charm.

    Reply  |  Quote
  24. Ryan UNITED STATES Mozilla Firefox Windows says:

    This was one of the more helpful items I have found about this topic. I had a problem with this re-occurring with a particular server, and I would use the instructions I found on this site to clear the print queue. I finally found what was causing this to happen time and time again. The folder WINDOWS\System32\Spool\PRINTERS had the read only attribute checked, after I unchecked this it has been three weeks since I had to manually empty this folder of files. Thanks for this post on this blog, I thought that this could help another user to fix the root of the print queue jam. I just found this blog to be helpful, so I wanted to pay it forward.

    Reply  |  Quote
  25. Rich UNITED STATES Mozilla Firefox Windows says:

    Great help. thought I was going to have to delete the printer and reinstall.

    Thanks.

    Reply  |  Quote
  26. Jonathan UNITED STATES Internet Explorer Windows says:

    Wow, that was incredibly helpful and yet so simple. You’re right; it should be common knowledge.

    Reply  |  Quote
  27. Kristin UNITED STATES Internet Explorer Windows says:

    Thank you, thank you!! I tried performing your steps in Vista but kept getting a “System 5 Error Access is Denied” error when attempting to stop using the net stop spooler command in run window, but I just went into the Services console (via Administrative Tools in the Control Panel) stopped the “Print Spooler” service, deleted the files located in %SYSTEMROOT%\system32\spool\PRINTERS, restarted the service and it worked like a charm.

    Reply  |  Quote
  28. Luke Maciak UNITED STATES Mozilla Firefox Ubuntu Linux Terminalist says:

    @Kristin: Yeah, Vista is a bit different with it’s access protection features. The net command likely doesn’t invoke the privilege escalation dialog, but the services.msc console you used does.

    I’m glad you figured it out. :)

    Reply  |  Quote
  29. monica UNITED STATES Internet Explorer Windows says:

    When i try to do this it says access denied…..What does that mean?

    Reply  |  Quote
  30. Luke Maciak UNITED STATES Mozilla Firefox Windows Terminalist says:

    @monica: It may mean two things:

    1. The spooler service is still running – you probably did not stop it properly
    2. You are not an administrator – try logging in as Administrator

    Reply  |  Quote
  31. Esther Hoffman UNITED STATES Mozilla Firefox Windows says:

    Thanks a lot for this very useful post. It worked perfectly for me in Windows Vista.

    Reply  |  Quote
  32. wordwych UNITED STATES Mozilla Firefox Windows says:

    Having just spent the past 2.5 hours cursing my HP (HeinousPOS) printer for all manner of issues, including the printer queue jam, I thank you very very much for these instructions. I have copied them to a Word file and labeled it “Printer FU Fix.” It will live on my desktop, where it is easily accessible, until this printer dies or I lose my patience, take it outside and empty my .12 gauge into it. :-)

    Reply  |  Quote
  33. Thank YOU UNITED STATES Safari Windows says:

    THANK U!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Reply  |  Quote
  34. Rose UNITED STATES Internet Explorer Windows says:

    Thank you! Worked great! I get so nervous to touch any of the DOS stuff and typing in commands, but this was easy and worked great.

    Reply  |  Quote
  35. Luke Maciak UNITED STATES Mozilla Firefox Ubuntu Linux Terminalist says:

    @Rose: Nah, command line is not scary. It’s fun. :)

    I’m glad it worked for you!

    Reply  |  Quote
  36. Rich B NEW ZEALAND Google Chrome Windows says:

    Hey mate,

    Thank you for these. Googled up some help and you came to the rescue. Have always wondered how to do this and now i know. Will save this link for next time.

    Thanks very much.

    Reply  |  Quote
  37. Carla UNITED STATES Mozilla Firefox Windows says:

    @ Daniel Montero:

    Hey Dan,

    I tried the batch file and to no avail. I ran the command manually as well. Any other suggestions?

    Carla

    Reply  |  Quote
  38. Supreet CANADA Mozilla Firefox Windows says:

    I have a printer on the Fileserver that is showing up as offline. I restarted the fileserver…now is on the ready mode. But as soon as someone tries to print from that printer, it goes on the error mode again. ( its Dell 1720dn ). Please Help ?

    Reply  |  Quote
  39. Nemea UNITED STATES Mozilla Firefox Windows says:

    How do I unsubscribe to this thread? I am still getting updates.

    Reply  |  Quote
  40. Nemea UNITED STATES Mozilla Firefox Windows says:

    Never mind, figured it out!

    Reply  |  Quote
  41. Liz UNITED STATES Mozilla Firefox Windows says:

    @ Luke:

    Thanks for this post! I’ve been trying to fix this problem for three days and looked everywhere, but this is what worked. I’m not technically proficient at all, this was a great help.

    Reply  |  Quote
  42. Bill C. UNITED STATES Mozilla Firefox Windows says:

    When I try this I get “System error 5 has occurred. Access is denied.”

    I am most definitely logged in as an admin so I don’t know what to do about this.

    Reply  |  Quote
  43. Elle CANADA Mozilla Firefox Windows says:

    same problem as bill
    what now?

    Reply  |  Quote
  44. adiveket ISRAEL Internet Explorer Windows says:

    thanks !
    it solved the problem !

    Reply  |  Quote
  45. Time Traveler CANADA Google Chrome Windows says:

    Did you have any idea that when you wrote this 4 years ago that you were actually saving the life of a PC? Amazing.

    Almost went totally ape-s*** on this PC with a bat.

    Thank you sir.

    Sincerely,
    The Time Traveler

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>