Operation Could not be completed when running printer batch

August 20, 2012 at 11:12:46
Specs: Windows 7
Operation could not be completed error when installing printer.

Here is my script.

@ECHO OFF
echo finding printers
C:\ABC\sys-tools\printers\FindName.vbs


echo looking for printer name "label printer"
FIND /C /I "Label" FindName.txt
IF NOT ERRORLEVEL 0 goto LABELX


start cmd.exe /c rundll32 printui.dll,PrintUIEntry /y /q /n "Label Printer"


start C:\ABC\sys-tools\printers\FindState.vbs


start C:\ABC\sys-tools\printers\FindStatus.vbs


FIND /C /I "State: 1" FindState.txt
IF NOT ERRORLEVEL 1 goto LABELQ


FIND /C /I "Status: 2" FindStatus.txt
IF NOT ERRORLEVEL 1 goto LABELQ


start C:\ABC\sys-tools\printers\GetDriver.vbs

echo "Reading driver information..."

FIND /C /I "ZDesigner" output.txt
IF NOT ERRORLEVEL 1 goto LABEL1

echo "NO 403 found, trying 2030"

FIND /C /I "TTP 2030" output.txt
IF NOT ERRORLEVEL 1 goto LABEL2
IF NOT ERRORLEVEL 0 goto LABELx


:LABELX
echo "No printer found... sending an email to tell on you....
rem call printer email vb script here
start C:\ABC\sys-tools\printers\printer_notify.vbs


goto END


LABELQ:
start C:\ABC\sys-tools\printers\status_notify.vbs
GoTo END

goto END


:LABEL1
echo "setting kr403"
start cmd.exe /c "rundll32 printui.dll,PrintUIEntry /Sr /n "Label Printer" /a "C:\ABC\sys-tools\printers\kr403.dat""


goto END


:LABEL2
echo "setting 2030"
start cmd.exe /c "rundll32 printui.dll,PrintUIEntry /Sr /n "Label Printer" /a "C:\ABC\sys-tools\printers\2030.dat""


goto END


:END
echo "Done!!!"
exit

This script works on some machines and on other I get the error " Operation could not be completed". Any help is appreciated.



See More: Operation Could not be completed when running printer batch

Report •


#1
August 20, 2012 at 11:14:09
It seems to work fine until it gets to the following lines.

:LABEL1
echo "setting kr403"
start cmd.exe /c "rundll32 printui.dll,PrintUIEntry /Sr /n "Label Printer" /a "C:\ABC\sys-tools\printers\kr403.dat""


goto END


:LABEL2
echo "setting 2030"
start cmd.exe /c "rundll32 printui.dll,PrintUIEntry /Sr /n "Label Printer" /a "C:\ABC\sys-tools\printers\2030.dat""


--------------------------------------------------------------------------------


Operation could not be completed error when installing printer.
Here is my script.

@ECHO OFF
echo finding printers
C:\ABC\sys-tools\printers\FindName.vbs


echo looking for printer name "label printer"
FIND /C /I "Label" FindName.txt
IF NOT ERRORLEVEL 0 goto LABELX


start cmd.exe /c rundll32 printui.dll,PrintUIEntry /y /q /n "Label Printer"


start C:\ABC\sys-tools\printers\FindState.vbs


start C:\ABC\sys-tools\printers\FindStatus.vbs


FIND /C /I "State: 1" FindState.txt
IF NOT ERRORLEVEL 1 goto LABELQ


FIND /C /I "Status: 2" FindStatus.txt
IF NOT ERRORLEVEL 1 goto LABELQ


start C:\ABC\sys-tools\printers\GetDriver.vbs


echo "Reading driver information..."

FIND /C /I "ZDesigner" output.txt
IF NOT ERRORLEVEL 1 goto LABEL1


echo "NO 403 found, trying 2030"

FIND /C /I "TTP 2030" output.txt
IF NOT ERRORLEVEL 1 goto LABEL2
IF NOT ERRORLEVEL 0 goto LABELx


:LABELX
echo "No printer found... sending an email to tell on you....
rem call printer email vb script here
start C:\ABC\sys-tools\printers\printer_notify.vbs


goto END


LABELQ:
start C:\ABC\sys-tools\printers\status_notify.vbs
GoTo END

goto END

:LABEL1
echo "setting kr403"
start cmd.exe /c "rundll32 printui.dll,PrintUIEntry /Sr /n "Label Printer" /a "C:\ABC\sys-tools\printers\kr403.dat""


goto END


:LABEL2
echo "setting 2030"
start cmd.exe /c "rundll32 printui.dll,PrintUIEntry /Sr /n "Label Printer" /a "C:\ABC\sys-tools\printers\2030.dat""



Report •

#2
August 20, 2012 at 18:27:01
"start" without the "wait" option may be fouling you up. Your batch will keep cranking full speed while the parallel process (invoked by "start") is moseying along.
start /wait cmd.exe blah blah
(check out: start /?, cmd /? but you probably already have).
Just a guess, I don't know.

Report •

Related Solutions


Ask Question