Delete print jobs from command line or batch file?

  • Thread starter Thread starter Dave R.
  • Start date Start date
D

Dave R.

I'm looking for a way to delete all print jobs for the current user from
the command line or using a batch file under Windows Vista Business.
The user accounts this will run under are standard limited accounts with
default rights, so cannot stop the print spooler service and delete
files in the spooler directory as was suggested in the only thread
Google could find that addressed a similar issue. Printers are local
and not shared, there may be more than one, and the names of the
printers vary from situation to situation.

Is this possible, and if so, how?

Regards,

Dave
 
Dave R. said:
I'm looking for a way to delete all print jobs for the current user from
the command line or using a batch file under Windows Vista Business.

I use this under XP. Plus it might not be quite the same thing, but
it could be of interest:

@echo off & setlocal enableextensions
echo +----------------------------------------------------+
echo ¦ CLRSPOOL.CMD Stop and reset print spooler ¦
echo ¦ By Prof. Timo Salmi, Last modified Mon 30-Jan-2006 ¦
echo +----------------------------------------------------+
::
if "%~1"=="?" goto _usage
if "%~1"=="/?" goto _usage
::
:: The path to the spooler files
set spool_=C:\WINDOWS\system32\spool\PRINTERS
::
:: Spool contents
dir "%spool_%"
echo.
::
:: Ask for confirmation
set ask_=
set /p ask_="Reset the print spooler [Y/n]?"
if /i [%ask_%]==[n] goto _out
::
:: Clear the spooler
net stop spooler
for %%f in ("%spool_%\*.*") do (
if exist "%%f" del "%%f"
)
net start spooler
:: See FAQ item #2 for an explanation of the next line
dir "%spool_%"
if not defined cmdbox if defined PauseIfFromDesktop pause
goto _out
::
:_usage
echo.
echo Usage: CLRSPOOL
echo.
echo High enough user privileges are required to complete this task.
echo Else the net stop/start commands will just produce error
messages.
goto _out
::
:_out
endlocal & goto :EOF

All the best, Timo
 
Timo Salmi said:
I use this under XP. Plus it might not be quite the same thing, but
it could be of interest:

Thank you, Timo. Nice routine, but as you noted it requires sufficient
privileges to be able to start and stop the spooler service, so it
doesn't help me much. Hopefully others will find it useful, though.

As a suggestion, you might consider replacing the explicit reference to
C:\WINDOWS to %SystemRoot% instead so it works reliably on a wider range
of systems.

Best regards,

Dave
 
In said:
I'm looking for a way to delete all print jobs for the current
user from the command line or using a batch file under Windows
Vista Business. The user accounts this will run under are
standard limited accounts with default rights, so cannot stop
the print spooler service and delete files in the spooler
directory as was suggested in the only thread Google could find
that addressed a similar issue. Printers are local and not
shared, there may be more than one, and the names of the
printers vary from situation to situation.

Can we assume then (in Vista) that
NET PRINT
to delte by job# is not an option?
(W2K here)
 
Mark V said:
Can we assume then (in Vista) that
NET PRINT
to delte by job# is not an option?
(W2K here)

Since the printers are not shared, I don't think NET PRINT applies - at
least, my efforts to use it have failed. If you can suggest a way to
use that approach, I'm all ears (er, eyes...).

Regards,

Dave
 
[ ]
Since the printers are not shared, I don't think NET PRINT
applies - at least, my efforts to use it have failed. If you
can suggest a way to use that approach, I'm all ears (er,
eyes...).

Nope and sorry. No Vista here now or later. Just spitting ideas
into the wind.
 
Back
Top