A

Cancel pending printing jobs with a simple batch file

If you have ever used printers (most of you will obviously have), you must be knowing that it can be a real pain when we want to cancel a print job but it will just not go away. Why it takes so long to cancel print job? This occurs because the temporary file created for […]

If you have ever used printers (most of you will obviously have), you must be knowing that it can be a real pain when we want to cancel a print job but it will just not go away.

Why it takes so long to cancel print job?

This occurs because the temporary file created for printing the job can’t be deleted because it is being continuously accessed by windows. One solution is to kill the spoolsv.exe service using Task Manager and delete all jobs present in C:\Windows\System32\spool\PRINTERS and then either restart the spoolsv.exe service or restart the computer so that the service is restarted by itself. But we can do all these steps by automating the work with batch files.

Download batch file

[adsense]
This batch file will quickly cancel print queue so that you can now continue with printing more jobs.

Flush printing job queue (Batch file)

The content of the batch file is as follows

@echo off
echo Stopping print spooler.
echo.
net stop spooler
echo deleting stuff... where? I'm not sure. Just deleting stuff.
echo.
del %systemroot%\system32\spool\printers\*.shd
del %systemroot%\system32\spool\printers\*.spl
echo Starting print spooler.
echo.
net start spooler

Now whenever you need to instantly cancel print queue, just double click on the batch file and it will delete the pending jobs. A very good piece of advice by Pallav is to be careful while using this batch file in a work environment as if you are on a print server, it would cancel printing jobs of all connected printers.

Thanks to Pallab for bringing my attention and to Lifehacker for the code.

You can also make a custom command which you can type in Run (Win + R) to execute the batch file. Read Creating Custom Run Commands

2 responses to “Cancel pending printing jobs with a simple batch file”

  1. Copied and saved it, it may come in use

    • Ashfame says:

      You can also make a custom Run Command for cancelling the print job queue. I have updated the post with a link to my old tutorial. πŸ™‚