• Client: Windows XP
  • Print Server: Ubuntu via CUPS

Is there a way to query the printer queue on the server from a client to retrieve the name of the file being printed?

Code example would be something like:

FOR /F "tokens=* USEBACKQ" %%F IN (`COMMAND TO QUERY PRINT JOBS ^| FIND "FILENAME"`) DO (
SET var=%%F
)
IF NOT DEFINED var (
ECHO Print Job Does Not Exist
) ELSE (
ECHO Print Job Completed
)
link|improve this question

Doesn't it appear in the printer properties/what's printing window, like it does for a regular Windows based printer? – John Gardeniers Jun 8 '11 at 22:49
Keep in mind I want to pull this information from a batch script (command line) and not the GUI. I need to be able to pull the string containing the name of the file being printed to create an argument... updating the question with a sample of what the code COULD look like. – Mechaflash Jun 9 '11 at 13:16
feedback

1 Answer

I totally forgot to update this =D.

My solution ended up being querying the local print queue on the workstation.

CSCRIPT "C:\WINDOWS\system32\PRNJOBS.vbs" -l ^| FIND /I "printed file"

Running that queries the local print jobs with their file names, then I search for the file in the output to see if it successfully made it to the print queue. This is the closest that I could come to my solution and it has been working thusfar.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.