Batch Script Errors Works on my laptop but not others

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Batch Script Errors Works on my laptop but not others

#1 Post by wchristner » 04 Mar 2016 14:59

IOk So I have my batch file which works great on my laptop. However when I try to run this thing from a flash drive, it gives me two errors,
1 argument is invalid error
2 Windows cannot locate suitable printer driver.
The paths on which the printer drivers are located are correct. All PC's are on the same domain and have local admin rights. All laptops here
Can access the network folders no problem and I can Ping the printers so they are online.

Any help would be appreciated
Here is what I have so far. Prnport.vbs is on the flash drive and my path on line 40 and 64 points to it.
I am using notepad ++ to edit this. I am currently at a loss. If anyone had any experience and would like to help out
Please do. I would appreciate it.


@echo off
:Menu
cls
@echo Choose a Paw Paw Printer to install
@echo =========================================
@echo 1) Install Black and White Ricoh Printer
@echo 2) Install Xerox Color Printer
@echo 3) Install All Printers
@echo 4) Exit
@echo =========================================
@echo.
@echo After installing printers this file will self destruct!
@echo.

set /p op= Choose your Printer:


if {%op%}=={1} (goto :print1)
if {%op%}=={2} (goto :print2)
if {%op%}=={3} (goto :print3)
if {%op%}=={4} (goto :exit)
@echo.


:print1
@echo ########################################################################
@echo #
@echo *Kinexus* #
@echo #
@echo This will Install the Ricoh Black and White printer on your computer. #
@echo Once you click OK, it will run. It may take a minute to install. #
@echo During that time you will see no screen activity until it finishes. #
@echo Installing Printer.... please wait #
@echo. #
@echo ########################################################################
@echo.
@echo.
@echo.
@echo.
cscript %WINDIR%\F:\Prnport.vbs -a -r IP_192.***.***.*** -h 192.***.***.***.80 -o raw -n 9100
rundll32 printui.dll,PrintUIEntry /ia /m "Ricoh Aficio MP 6000 PCL" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\RICOH Aficio MP 6002 PCL\oemsetup.inf"
rundll32 printui.dll,PrintUIEntry /if /b "Paw Paw Black and White" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\RICOH Aficio MP 6002 PCL\oemsetup.inf" /r "IP_192.***.***.***" /m "Ricoh Aficio MP 6000 PCL"
@echo======================================================================
@echo =
@echo *Kinexus* =
@ECHO Installation of the Ricoh Black and White printer has completed! =
@echo If you have any problems, please contact IT. =
@echo =
@echo======================================================================
pause
goto Menu

:print2
@echo ########################################################################
@echo #
@echo *Kinexus* #
@echo #
@echo This will Install the Xerox Color printer on your computer. #
@echo Once you click OK, it will run. It may take a minute to install. #
@echo During that time you will see no screen activity until it finishes. #
@echo Installing Printer.... please wait #
@echo. #
@echo ########################################################################
cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r IP_192.***.***.*** -h 192.***.***.*** -o raw -n 9100
rundll32 printui.dll,PrintUIEntry /ia /m "Xerox Phaser 6180N PCL 6" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\Xerox6180N\64Bit\xrxkrzi.inf"
rundll32 printui.dll,PrintUIEntry /if /b "Paw Paw Color" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\Xerox6180N\64Bit\xrxkrzi.inf" /r "192.***.***.***" /m "Xerox Phaser 6180N PCL 6"
@echo======================================================================
@echo =
@echo *Kinexus* =
@ECHO Installation of the Xerox Color printer has completed! =
@echo If you have any problems, please contact IT. =
@echo =
@echo======================================================================
pause
goto Menu



:print3
@echo ########################################################################
@echo #
@echo *Kinexus* #
@echo #
@echo This will Install all Paw Paw printers on your computer. #
@echo Once you click OK, it will run. It may take a minute to install. #
@echo During that time you will see no screen activity until it finishes. #
@echo Installing Printer.... please wait #
@echo. #
@echo ########################################################################
cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r IP_192.***.***.*** -h 192.***.***.*** -o raw -n 9100
rundll32 printui.dll,PrintUIEntry /ia /m "Ricoh Aficio MP 6000 PCL" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\RICOH Aficio MP 6002 PCL\oemsetup.inf"
rundll32 printui.dll,PrintUIEntry /if /b "BH Paw Paw Black and White" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\RICOH Aficio MP 6002 PCL\oemsetup.inf" /r "IP_192.***.***.***" /m "Ricoh Aficio MP 6000 PCL"

cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r IP_192.***.***.*** -h 192.***.***.*** -o raw -n 9100
rundll32 printui.dll,PrintUIEntry /ia /m "Xerox Phaser 6180N PCL 6" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\Xerox6180N\64Bit\xrxkrzi.inf"
rundll32 printui.dll,PrintUIEntry /if /b "Paw Paw Color" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\Xerox6180N\64Bit\xrxkrzi.inf" /r "192.***.***.***" /m "Xerox Phaser 6180N PCL 6"
@echo======================================================================
@echo =
@echo *Kinexus* =
@ECHO Installation of both Xerox & Ricoh printes has completed! =
@echo If you have any problems, please contact IT. =
@echo =
@echo======================================================================
pause
goto Menu

:exit
exit

kwsiebert
Posts: 43
Joined: 20 Jan 2016 15:46

Re: Batch Script Errors Works on my laptop but not others

#2 Post by kwsiebert » 04 Mar 2016 15:25

wchristner wrote:cscript %WINDIR%\F:\Prnport.vbs -a -r IP_192.***.***.*** -h 192.***.***.***.80 -o raw -n 9100

cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r IP_192.***.***.*** -h 192.***.***.*** -o

cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r IP_192.***.***.*** -h 192.***.***.*** -o

cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r IP_192.***.***.*** -h 192.***.***.*** -o

You said that Prnport.vbs is on the flash drive, but none of these lines point to it properly. If it is in the same directory as the batch itself, try "%~dp0\Prnport.vbs".

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: Batch Script Errors Works on my laptop but not others

#3 Post by wchristner » 04 Mar 2016 15:36

I updated the paths, to cscript %WINDIR%\F:\Prnport.vbs on all printer installs, not working I am going to try kwsiebert's suggestion. Thanks I will let you know what happens

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: Batch Script Errors Works on my laptop but not others

#4 Post by wchristner » 04 Mar 2016 15:39

well the only thing i can get working is option 4 the exit command
thanks anyway, any more ideas ... i'm open to them.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Batch Script Errors Works on my laptop but not others

#5 Post by foxidrive » 04 Mar 2016 16:00

wchristner wrote:I updated the paths, to cscript %WINDIR%\F:\Prnport.vbs on all printer installs

That's going to resolve to "c:\windows\F:\Prnport.vbs"

You could use F:\Prnport.vbs but then the USB drive letter can easily change.

If the VBS file is in the same folder then just Prnport.vbs should work, unless elevating permissions is being used when kwsiebert's suggestion is needed.

kwsiebert
Posts: 43
Joined: 20 Jan 2016 15:46

Re: Batch Script Errors Works on my laptop but not others

#6 Post by kwsiebert » 04 Mar 2016 16:09

Is the error message still the same? What line is causing it? Please provide as much detail as possible. Due to it relying on the vbs file and printers, other people can't test the script themselves.

I also see that if someone enters an option other than 1-4, it's going to fall through to option 1.

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: Batch Script Errors Works on my laptop but not others

#7 Post by wchristner » 07 Mar 2016 06:53

The message is still the same.
:The Arguments are Invalid

: Operation could not be completed (error 0x00000705)
Windows cannot locate a suitable printer driver. Contact your administrator for help locating and installing a suitable driver.
This is all under Windows 7

Thanks

Post Reply