Code: Select all
@ECHO OFF
:: Check Windows version
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
SETLOCAL ENABLEDELAYEDEXPANSION
:: Check number of command line arguments
IF "%~1"=="" GOTO Syntax
IF NOT "%~4"=="" GOTO Syntax
:: Check if WMIC is available
WMIC.EXE /? >NUL 2>&1 || GOTO Syntax
:: Initialize variables
SET Printer=%~1
SET PrinterSet=0
SET UseAllPrn=0
SET UseDefault=0
SET Action=%~2
SET ActFlush=0
SET ActList=0
SET ActPause=0
SET ActResume=0
SET ActionSet=0
SET Option=%~3
SET OptionSet=0
SET Quiet=0
set ExtendedPrinterStatus=0
:: Parse command line arguments
:: Mandatory first argument: printer name, /All, /Default or /List
IF NOT "%Printer%"=="" (
IF /I "%Printer:~0,2%"=="/L" (
IF NOT "%~2"=="" GOTO Syntax
SET Action=List
SET ActList=1
SET ActionSet=1
SET Printer=/All
SET UseAllPrn=1
SET PrinterSet=1
)
IF /I "!Printer:~0,2!"=="/A" (
SET UseAllPrn=1
SET PrinterSet=1
)
IF /I "!Printer:~0,2!"=="/D" (
SET UseDefault=1
SET PrinterSet=1
)
ECHO "!Printer!" | FINDSTR /R /C:"[/%%?\*]" >NUL
IF ERRORLEVEL 1 SET PrinterSet=1
)
IF NOT "%PrinterSet%"=="1" GOTO Syntax
:: Second argument, mandatory unless the first argument is /List: /Flush, /List, /Pause or /Resume
IF /I "%Action:~0,2%"=="/L" GOTO Syntax
IF /I "%Action:~0,2%"=="/F" (
SET Action=CancelAllJobs
SET ActFlush=1
SET ActionSet=1
)
IF /I "%Action:~0,2%"=="/P" (
SET Action=Pause
SET ActPause=1
SET ActionSet=1
)
IF /I "%Action:~0,2%"=="/R" (
SET Action=Resume
SET ActResume=1
SET ActionSet=1
)
IF NOT "%ActionSet%"=="1" GOTO Syntax
:: Optional third argument: /Quiet or /Verbose (default)
IF "%Option%"=="" (
SET OptionSet=1
) ELSE (
IF /I "%Option:~0,2%"=="/Q" (
SET Quiet=1
SET OptionSet=1
)
IF /I "%Option:~0,2%"=="/V" (
SET OptionSet=1
)
)
IF NOT "%OptionSet%"=="1" GOTO Syntax
SET Query1=Path Win32_Printer
IF "%UseDefault%"=="1" (
SET Query1=%Query1% WHERE "Default='TRUE'"
) ELSE (
IF NOT "%UseAllPrn%"=="1" (
SET Query1=%Query1% WHERE "DeviceID='%Printer%'"
)
)
:: Status number to descriptive text
SET Status_0=--Error--
SET Status_1=Other
SET Status_2=Unknown
SET Status_3=Idle
SET Status_4=Printing
SET Status_5=Warmup
SET Status_6=StoppedPrinting
SET Status_7=Offline
SET Status_8=Paused
SET Status_9=Error
SET Status_10=Busy
SET Status_11=NotAvailable
SET Status_12=Waiting
SET Status_13=Processing
SET Status_14=Initialization
SET Status_15=PowerSave
SET Status_16=PendingDeletion
SET Status_17=IOActive
SET Status_18=ManualFeed
IF "%ActFlush%"=="1" (
FOR /F "tokens=1* delims==" %%A IN ('WMIC %Query1% Get DeviceID /Format:list ^| FIND "="') DO CALL :FlushJobs "%%~B"
) ELSE (
FOR /F "tokens=1* delims==" %%A IN ('WMIC %Query1% Get DeviceID /Format:list ^| FIND "="') DO CALL :PRPrinting "%%~B"
)
GOTO:EOF
ENDLOCAL
:FlushJobs
SETLOCAL
:: Query the printer
FOR /F "tokens=*" %%A IN ('WMIC Path Win32_Printer WHERE "DeviceID='%~1'" Get DeviceID^,ExtendedPrinterStatus /Format:list ^| FIND "="') DO SET %%A
:: Get number of printjobs
SET PrintJobs=0
FOR /F "tokens=*" %%A IN ('WMIC Path Win32_PrintJob WHERE "Name LIKE '%~1%%'" Get Name /Format:list 2^>^&1 ^| FIND "="') DO SET /A PrintJobs += 1
:: Display the results
ECHO Printer : %DeviceID%
ECHO Print Jobs : %PrintJobs%
ECHO Status : !Status_%ExtendedPrinterStatus%!
IF %PrintJobs% GTR 0 (
ECHO Flush all printjobs . . .
WMIC Path Win32_Printer WHERE "DeviceID='%~1'" Call %Action% >NUL 2>&1
:: Display the result
SET PrintJobs=0
FOR /F "tokens=*" %%A IN ('WMIC Path Win32_PrintJob WHERE "Name LIKE '%~1%%'" Get Name /Format:list 2^>^&1 ^| FIND "="') DO SET /A PrintJobs += 1
ECHO Print Jobs : %PrintJobs%
)
ECHO.
ENDLOCAL
GOTO:EOF
:PRPrinting
SETLOCAL
:: Query the printer
FOR /F "tokens=*" %%A IN ('WMIC Path Win32_Printer WHERE "DeviceID='%~1'" Get DeviceID^,ExtendedPrinterStatus /Format:list ^| FIND "="') DO SET %%A
:: Get number of printjobs
SET PrintJobs=0
FOR /F "tokens=*" %%A IN ('WMIC Path Win32_PrintJob WHERE "Name LIKE '%~1%%'" Get Name /Format:list 2^>^&1 ^| FIND "="') DO SET /A PrintJobs += 1
:: Display the results
ECHO Printer : %DeviceID%
ECHO Print Jobs : %PrintJobs%
ECHO Status : !Status_%ExtendedPrinterStatus%!
:: Resume if paused
IF %ActResume% EQU 1 IF %ExtendedPrinterStatus% EQU 8 (
ECHO %Action% printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='%~1'" Call %Action% >NUL 2>&1
FOR /F "tokens=*" %%A IN ('WMIC Path Win32_Printer WHERE "DeviceID='%~1'" Get ExtendedPrinterStatus /Format:list ^| FIND "="') DO SET New%%A
)
:: Pause if not yet paused
IF %ActPause% EQU 1 IF %ExtendedPrinterStatus% NEQ 8 (
ECHO %Action% printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='%~1'" Call %Action% >NUL 2>&1
FOR /F "tokens=*" %%A IN ('WMIC Path Win32_Printer WHERE "DeviceID='%~1'" Get ExtendedPrinterStatus /Format:list ^| FIND "="') DO SET New%%A
)
:: Display new status
IF %ActResume% EQU 1 IF %ExtendedPrinterStatus% EQU 8 (
ECHO Status : !Status_%NewExtendedPrinterStatus%!
)
IF %ActPause% EQU 1 IF %ExtendedPrinterStatus% NEQ 8 (
ECHO Status : !Status_%NewExtendedPrinterStatus%!
)
ECHO.
ENDLOCAL
GOTO:EOF
:Syntax
ECHO.
ECHO Printing.bat, Version 2.20 for Windows XP or later
ECHO Pause or resume printing, or flush all queued printjobs on the specified
ECHO printer(s), or list all printers, their status and number of printjobs
ECHO.
ECHO Usage: PRINTING printer action [ option ]
ECHO.
ECHO or: PRINTING /List
ECHO.
ECHO Where: "printer" is either /All, /Default or a printer name
ECHO "action" is either /Pause, /Resume or /Flush
ECHO "option" is either /Quiet or /Verbose (default)
ECHO.
ECHO Notes: Use doublequotes if the printer name contains spaces.
ECHO Do not specify a printer when /List switch is used.
ECHO Switches may be abbreviated, e.g. /D instead of /Default.
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
IF "%OS%"=="Windows_NT" ENDLOCAL
IF "%OS%"=="Windows_NT" EXIT /B 1
But it dose not seem to show Network printers
Since this is kinda over my head, can someone here help me fix this?
the command:
Code: Select all
print.bat /list
I added:(To make it not crash when it echo's the printer)
Code: Select all
set ExtendedPrinterStatus=0
output:(::@echo off)
Code: Select all
G:\InfoHack_Alpha10\printerror>IF NOT "Windows_NT" == "Windows_NT" GOTO Syntax
G:\InfoHack_Alpha10\printerror>SETLOCAL ENABLEDELAYEDEXPANSION
G:\InfoHack_Alpha10\printerror>IF "/list" == "" GOTO Syntax
G:\InfoHack_Alpha10\printerror>IF NOT "" == "" GOTO Syntax
G:\InfoHack_Alpha10\printerror>WMIC.EXE /? 1>NUL 2>&1 || GOTO Syntax
G:\InfoHack_Alpha10\printerror>SET Printer=/list
G:\InfoHack_Alpha10\printerror>SET PrinterSet=0
G:\InfoHack_Alpha10\printerror>SET UseAllPrn=0
G:\InfoHack_Alpha10\printerror>SET UseDefault=0
G:\InfoHack_Alpha10\printerror>SET Action=
G:\InfoHack_Alpha10\printerror>SET ActFlush=0
G:\InfoHack_Alpha10\printerror>SET ActList=0
G:\InfoHack_Alpha10\printerror>SET ActPause=0
G:\InfoHack_Alpha10\printerror>SET ActResume=0
G:\InfoHack_Alpha10\printerror>SET ActionSet=0
G:\InfoHack_Alpha10\printerror>SET Option=
G:\InfoHack_Alpha10\printerror>SET OptionSet=0
G:\InfoHack_Alpha10\printerror>SET Quiet=0
G:\InfoHack_Alpha10\printerror>set ExtendedPrinterStatus=0
G:\InfoHack_Alpha10\printerror>IF NOT "/list" == "" (
IF /I "/l" == "/L" (
IF NOT "" == "" GOTO Syntax
SET Action=List
SET ActList=1
SET ActionSet=1
SET Printer=/All
SET UseAllPrn=1
SET PrinterSet=1
)
IF /I "!Printer:~0,2!" == "/A" (
SET UseAllPrn=1
SET PrinterSet=1
)
IF /I "!Printer:~0,2!" == "/D" (
SET UseDefault=1
SET PrinterSet=1
)
ECHO "!Printer!" | FINDSTR /R /C:"[/%?\*]" 1>NUL
IF ERRORLEVEL 1 SET PrinterSet=1
)
G:\InfoHack_Alpha10\printerror>IF NOT "1" == "1" GOTO Syntax
G:\InfoHack_Alpha10\printerror>IF /I "Li" == "/L" GOTO Syntax
G:\InfoHack_Alpha10\printerror>IF /I "Li" == "/F" (
SET Action=CancelAllJobs
SET ActFlush=1
SET ActionSet=1
)
G:\InfoHack_Alpha10\printerror>IF /I "Li" == "/P" (
SET Action=Pause
SET ActPause=1
SET ActionSet=1
)
G:\InfoHack_Alpha10\printerror>IF /I "Li" == "/R" (
SET Action=Resume
SET ActResume=1
SET ActionSet=1
)
G:\InfoHack_Alpha10\printerror>IF NOT "1" == "1" GOTO Syntax
G:\InfoHack_Alpha10\printerror>IF "" == "" (SET OptionSet=1 ) ELSE (
IF /I "~0,2" == "/Q" (
SET Quiet=1
SET OptionSet=1
)
IF /I "~0,2" == "/V" (SET OptionSet=1 )
)
G:\InfoHack_Alpha10\printerror>IF NOT "1" == "1" GOTO Syntax
G:\InfoHack_Alpha10\printerror>SET Query1=Path Win32_Printer
G:\InfoHack_Alpha10\printerror>IF "0" == "1" (SET Query1=Path Win32_Printer WHERE "Default='TRUE'" ) ELSE (IF NOT "1" == "1" (SET Query1=Path Win32_Printer WHERE "DeviceID='/All'" ) )
G:\InfoHack_Alpha10\printerror>SET Status_0=--Error--
G:\InfoHack_Alpha10\printerror>SET Status_1=Other
G:\InfoHack_Alpha10\printerror>SET Status_2=Unknown
G:\InfoHack_Alpha10\printerror>SET Status_3=Idle
G:\InfoHack_Alpha10\printerror>SET Status_4=Printing
G:\InfoHack_Alpha10\printerror>SET Status_5=Warmup
G:\InfoHack_Alpha10\printerror>SET Status_6=StoppedPrinting
G:\InfoHack_Alpha10\printerror>SET Status_7=Offline
G:\InfoHack_Alpha10\printerror>SET Status_8=Paused
G:\InfoHack_Alpha10\printerror>SET Status_9=Error
G:\InfoHack_Alpha10\printerror>SET Status_10=Busy
G:\InfoHack_Alpha10\printerror>SET Status_11=NotAvailable
G:\InfoHack_Alpha10\printerror>SET Status_12=Waiting
G:\InfoHack_Alpha10\printerror>SET Status_13=Processing
G:\InfoHack_Alpha10\printerror>SET Status_14=Initialization
G:\InfoHack_Alpha10\printerror>SET Status_15=PowerSave
G:\InfoHack_Alpha10\printerror>SET Status_16=PendingDeletion
G:\InfoHack_Alpha10\printerror>SET Status_17=IOActive
G:\InfoHack_Alpha10\printerror>SET Status_18=ManualFeed
G:\InfoHack_Alpha10\printerror>IF "0" == "1" (FOR /F "tokens=1* delims==" %A IN ('WMIC Path Win32_Printer Get DeviceID /Format:list | FIND "="') DO CALL :FlushJobs "%~B" ) ELSE (FOR /F "tokens=1* delims==" %A IN ('WMIC Path Win32_Printer Get DeviceID /Format:list | FIND "="') DO CALL :PRPrinting "%~B" )
G:\InfoHack_Alpha10\printerror>CALL :PRPrinting "Zan Image Printer (Color)
"
G:\InfoHack_Alpha10\printerror>SETLOCAL
G:\InfoHack_Alpha10\printerror>FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='Zan Image Printer (Color)'" Get DeviceID,ExtendedPrinterStatus /Format:list | FIND "="') DO SET %A
G:\InfoHack_Alpha10\printerror>SET DeviceID=Zan Image Printer (Color)
G:\InfoHack_Alpha10\printerror>SET ExtendedPrinterStatus=2
G:\InfoHack_Alpha10\printerror>SET PrintJobs=0
G:\InfoHack_Alpha10\printerror>FOR /F "tokens=*" %A IN ('WMIC Path Win32_PrintJob WHERE "Name LIKE 'Zan Image Printer (Color)%'" Get Name /Format:list 2>&1 | FIND "="') DO SET /A PrintJobs += 1
G:\InfoHack_Alpha10\printerror>ECHO Printer : Zan Image Printer (Color)
Printer : Zan Image Printer (Color)
G:\InfoHack_Alpha10\printerror>ECHO Print Jobs : 0
Print Jobs : 0
G:\InfoHack_Alpha10\printerror>ECHO Status : !Status_2!
Status : Unknown
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 EQU 8 (
ECHO List printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='Zan Image Printer (Color)'" Call List 1>NUL 2>&1
FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='Zan Image Printer (Color)'" Get ExtendedPrinterStatus /Format:list | FIND "="') DO SET New%A
)
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 NEQ 8 (
ECHO List printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='Zan Image Printer (Color)'" Call List 1>NUL 2>&1
FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='Zan Image Printer (Color)'" Get ExtendedPrinterStatus /Format:list | FIND "="') DO SET New%A
)
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 EQU 8 (ECHO Status : !Status_! )
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 NEQ 8 (ECHO Status : !Status_! )
G:\InfoHack_Alpha10\printerror>ECHO.
G:\InfoHack_Alpha10\printerror>ENDLOCAL
G:\InfoHack_Alpha10\printerror>GOTO:EOF
G:\InfoHack_Alpha10\printerror>CALL :PRPrinting "Send To OneNote 2007
"
G:\InfoHack_Alpha10\printerror>SETLOCAL
G:\InfoHack_Alpha10\printerror>FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='Send To OneNote 2007'" Get DeviceID,ExtendedPrinterStatus /Format:list | FIND "="') DO SET %A
G:\InfoHack_Alpha10\printerror>SET DeviceID=Send To OneNote 2007
G:\InfoHack_Alpha10\printerror>SET ExtendedPrinterStatus=2
G:\InfoHack_Alpha10\printerror>SET PrintJobs=0
G:\InfoHack_Alpha10\printerror>FOR /F "tokens=*" %A IN ('WMIC Path Win32_PrintJob WHERE "Name LIKE 'Send To OneNote 2007%'" Get Name /Format:list 2>&1 | FIND "="') DO SET /A PrintJobs += 1
G:\InfoHack_Alpha10\printerror>ECHO Printer : Send To OneNote 2007
Printer : Send To OneNote 2007
G:\InfoHack_Alpha10\printerror>ECHO Print Jobs : 0
Print Jobs : 0
G:\InfoHack_Alpha10\printerror>ECHO Status : !Status_2!
Status : Unknown
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 EQU 8 (
ECHO List printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='Send To OneNote 2007'" Call List 1>NUL 2>&1
FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='Send To OneNote 2007'" Get ExtendedPrinterStatus /Format:list | FIND "="') DO SET New%A
)
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 NEQ 8 (
ECHO List printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='Send To OneNote 2007'" Call List 1>NUL 2>&1
FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='Send To OneNote 2007'" Get ExtendedPrinterStatus /Format:list | FIND "="') DO SET New%A
)
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 EQU 8 (ECHO Status : !Status_! )
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 NEQ 8 (ECHO Status : !Status_! )
G:\InfoHack_Alpha10\printerror>ECHO.
G:\InfoHack_Alpha10\printerror>ENDLOCAL
G:\InfoHack_Alpha10\printerror>GOTO:EOF
G:\InfoHack_Alpha10\printerror>CALL :PRPrinting "Microsoft XPS Document Writer
"
G:\InfoHack_Alpha10\printerror>SETLOCAL
G:\InfoHack_Alpha10\printerror>FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='Microsoft XPS Document Writer'" Get DeviceID,ExtendedPrinterStatus /Format:list | FIND "="') DO SET %A
G:\InfoHack_Alpha10\printerror>SET DeviceID=Microsoft XPS Document Writer
G:\InfoHack_Alpha10\printerror>SET ExtendedPrinterStatus=2
G:\InfoHack_Alpha10\printerror>SET PrintJobs=0
G:\InfoHack_Alpha10\printerror>FOR /F "tokens=*" %A IN ('WMIC Path Win32_PrintJob WHERE "Name LIKE 'Microsoft XPS Document Writer%'" Get Name /Format:list 2>&1 | FIND "="') DO SET /A PrintJobs += 1
G:\InfoHack_Alpha10\printerror>ECHO Printer : Microsoft XPS Document Writer
Printer : Microsoft XPS Document Writer
G:\InfoHack_Alpha10\printerror>ECHO Print Jobs : 0
Print Jobs : 0
G:\InfoHack_Alpha10\printerror>ECHO Status : !Status_2!
Status : Unknown
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 EQU 8 (
ECHO List printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='Microsoft XPS Document Writer'" Call List 1>NUL 2>&1
FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='Microsoft XPS Document Writer'" Get ExtendedPrinterStatus /Format:list | FIND "="') DO SET New%A
)
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 NEQ 8 (
ECHO List printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='Microsoft XPS Document Writer'" Call List 1>NUL 2>&1
FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='Microsoft XPS Document Writer'" Get ExtendedPrinterStatus /Format:list | FIND "="') DO SET New%A
)
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 EQU 8 (ECHO Status : !Status_! )
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 NEQ 8 (ECHO Status : !Status_! )
G:\InfoHack_Alpha10\printerror>ECHO.
G:\InfoHack_Alpha10\printerror>ENDLOCAL
G:\InfoHack_Alpha10\printerror>GOTO:EOF
G:\InfoHack_Alpha10\printerror>CALL :PRPrinting "Fax
"
G:\InfoHack_Alpha10\printerror>SETLOCAL
G:\InfoHack_Alpha10\printerror>FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='Fax'" Get DeviceID,ExtendedPrinterStatus /Format:list | FIND "="') DO SET %A
G:\InfoHack_Alpha10\printerror>SET DeviceID=Fax
G:\InfoHack_Alpha10\printerror>SET ExtendedPrinterStatus=2
G:\InfoHack_Alpha10\printerror>SET PrintJobs=0
G:\InfoHack_Alpha10\printerror>FOR /F "tokens=*" %A IN ('WMIC Path Win32_PrintJob WHERE "Name LIKE 'Fax%'" Get Name /Format:list 2>&1 | FIND "="') DO SET /A PrintJobs += 1
G:\InfoHack_Alpha10\printerror>ECHO Printer : Fax
Printer : Fax
G:\InfoHack_Alpha10\printerror>ECHO Print Jobs : 0
Print Jobs : 0
G:\InfoHack_Alpha10\printerror>ECHO Status : !Status_2!
Status : Unknown
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 EQU 8 (
ECHO List printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='Fax'" Call List 1>NUL 2>&1
FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='Fax'" Get ExtendedPrinterStatus /Format:list | FIND "="') DO SET New%A
)
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 NEQ 8 (
ECHO List printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='Fax'" Call List 1>NUL 2>&1
FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='Fax'" Get ExtendedPrinterStatus /Format:list | FIND "="') DO SET New%A
)
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 EQU 8 (ECHO Status : !Status_! )
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 2 NEQ 8 (ECHO Status : !Status_! )
G:\InfoHack_Alpha10\printerror>ECHO.
G:\InfoHack_Alpha10\printerror>ENDLOCAL
G:\InfoHack_Alpha10\printerror>GOTO:EOF
G:\InfoHack_Alpha10\printerror>CALL :PRPrinting "\\192.168.1.1\HP Color LaserJet CM1015 PCL 6
"
G:\InfoHack_Alpha10\printerror>SETLOCAL
G:\InfoHack_Alpha10\printerror>FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='\\192.168.1.1\HP Color LaserJet CM1015 PCL 6'" Get DeviceID,ExtendedPrinterStatus /Format:list | FIND "="') DO SET %A
G:\InfoHack_Alpha10\printerror>SET PrintJobs=0
G:\InfoHack_Alpha10\printerror>FOR /F "tokens=*" %A IN ('WMIC Path Win32_PrintJob WHERE "Name LIKE '\\192.168.1.1\HP Color LaserJet CM1015 PCL 6%'" Get Name /Format:list 2>&1 | FIND "="') DO SET /A PrintJobs += 1
G:\InfoHack_Alpha10\printerror>SET /A PrintJobs += 1
G:\InfoHack_Alpha10\printerror>ECHO Printer :
Printer :
G:\InfoHack_Alpha10\printerror>ECHO Print Jobs : 1
Print Jobs : 1
G:\InfoHack_Alpha10\printerror>ECHO Status : !Status_0!
Status : --Error--
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 0 EQU 8 (
ECHO List printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='\\192.168.1.1\HP Color LaserJet CM1015 PCL 6'" Call List 1>NUL 2>&1
FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='\\192.168.1.1\HP Color LaserJet CM1015 PCL 6'" Get ExtendedPrinterStatus /Format:list | FIND "="') DO SET New%A
)
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 0 NEQ 8 (
ECHO List printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='\\192.168.1.1\HP Color LaserJet CM1015 PCL 6'" Call List 1>NUL 2>&1
FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='\\192.168.1.1\HP Color LaserJet CM1015 PCL 6'" Get ExtendedPrinterStatus /Format:list | FIND "="') DO SET New%A
)
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 0 EQU 8 (ECHO Status : !Status_! )
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 0 NEQ 8 (ECHO Status : !Status_! )
G:\InfoHack_Alpha10\printerror>ECHO.
G:\InfoHack_Alpha10\printerror>ENDLOCAL
G:\InfoHack_Alpha10\printerror>GOTO:EOF
G:\InfoHack_Alpha10\printerror>CALL :PRPrinting "\\192.168.1.1\HP LaserJet 1200 Series PCL
"
G:\InfoHack_Alpha10\printerror>SETLOCAL
G:\InfoHack_Alpha10\printerror>FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='\\192.168.1.1\HP LaserJet 1200 Series PCL'" Get DeviceID,ExtendedPrinterStatus /Format:list | FIND "="') DO SET %A
G:\InfoHack_Alpha10\printerror>SET PrintJobs=0
G:\InfoHack_Alpha10\printerror>FOR /F "tokens=*" %A IN ('WMIC Path Win32_PrintJob WHERE "Name LIKE '\\192.168.1.1\HP LaserJet 1200 Series PCL%'" Get Name /Format:list 2>&1 | FIND "="') DO SET /A PrintJobs += 1
G:\InfoHack_Alpha10\printerror>SET /A PrintJobs += 1
G:\InfoHack_Alpha10\printerror>ECHO Printer :
Printer :
G:\InfoHack_Alpha10\printerror>ECHO Print Jobs : 1
Print Jobs : 1
G:\InfoHack_Alpha10\printerror>ECHO Status : !Status_0!
Status : --Error--
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 0 EQU 8 (
ECHO List printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='\\192.168.1.1\HP LaserJet 1200 Series PCL'" Call List 1>NUL 2>&1
FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='\\192.168.1.1\HP LaserJet 1200 Series PCL'" Get ExtendedPrinterStatus /Format:list | FIND "="') DO SET New%A
)
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 0 NEQ 8 (
ECHO List printing . . .
WMIC Path Win32_Printer WHERE "DeviceID='\\192.168.1.1\HP LaserJet 1200 Series PCL'" Call List 1>NUL 2>&1
FOR /F "tokens=*" %A IN ('WMIC Path Win32_Printer WHERE "DeviceID='\\192.168.1.1\HP LaserJet 1200 Series PCL'" Get ExtendedPrinterStatus /Format:list | FIND "="') DO SET New%A
)
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 0 EQU 8 (ECHO Status : !Status_! )
G:\InfoHack_Alpha10\printerror>IF 0 EQU 1 IF 0 NEQ 8 (ECHO Status : !Status_! )
G:\InfoHack_Alpha10\printerror>ECHO.
G:\InfoHack_Alpha10\printerror>ENDLOCAL
G:\InfoHack_Alpha10\printerror>GOTO:EOF
G:\InfoHack_Alpha10\printerror>GOTO:EOF
Please Help!