PC Review


Reply
Thread Tools Rate Thread

Delete print jobs from command line or batch file?

 
 
Dave R.
Guest
Posts: n/a
 
      13th Apr 2007
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


 
Reply With Quote
 
 
 
 
Timo Salmi
Guest
Posts: n/a
 
      13th Apr 2007
Dave R. <dwragle at drbsystems dot com> wrote:
> 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

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
private.php?do=newpm&u= <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Useful script files and tricks ftp://garbo.uwasa.fi/pc/link/tscmd.zip
 
Reply With Quote
 
Dave R.
Guest
Posts: n/a
 
      13th Apr 2007

"Timo Salmi" <(E-Mail Removed)> wrote in message
news:evo3m0$sgj$(E-Mail Removed)...
> Dave R. <dwragle at drbsystems dot com> wrote:
>> 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:
>


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


 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      13th Apr 2007
In alt.msdos.batch.nt, Dave R. wrote:

> 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)
 
Reply With Quote
 
Dave R.
Guest
Posts: n/a
 
      16th Apr 2007

"Mark V" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In alt.msdos.batch.nt, Dave R. wrote:
>
>> 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)


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


 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      16th Apr 2007
In alt.msdos.batch.nt, Dave R. wrote:

>
> "Mark V" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> In alt.msdos.batch.nt, Dave R. wrote:
>>
>>> 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

[ ]

>> 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...).


Nope and sorry. No Vista here now or later. Just spitting ideas
into the wind.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
printui.dll command line in a batch file with win XP sp2 freddy Windows XP Print / Fax 0 29th Dec 2009 06:05 PM
outlook by command line or batch file. Mary Microsoft Outlook 1 10th Jun 2009 09:25 AM
Batch file works in command line but not as a batch Danger Windows XP General 7 5th Feb 2008 04:50 PM
Print execution of batch file line-by-line? brianbasquille@gmail.com Microsoft C# .NET 1 16th Apr 2006 04:54 PM
How to print word (excel) documents from the command line batch file or VBS script? Ales Baranek Microsoft Word Document Management 1 4th Jan 2004 12:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:13 AM.