0
votes

Even though I appear to write it as pretty much all the examples on the web, I still have this error. Here, take a look... http://i.imgur.com/1TqL52V.png

My code is as follows (in case you didn't take a look):

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnport.vbs" -a -r "C70 PS Driver" -h 13.226.51.135 -o raw -n 9200
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs" -a -v 3 -m "Xerox Color C70 PS" -i "C:\Xerox_C70_2014_11\XCC70_5.382.4.0_PS_x64_Driver.inf\x2GITHP.inf" -h "C:\Xerox_C70_2014_11\XCC70_5.382.4.0_PS_x64_Driver.inf"
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs" -a -p "Xerox Color C70 PS" -m "Xerox Color C70 PS" -r "C70 PS Driver"

The error is at line 1, and says:

Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved.

C:\Users\Antoine\AppData\Local\Adersoft\VbsEdit\Temp\MMNPNCCZ.vbs(1, 78) Microsoft VBScript >compilation error: Expected end of statement

***** script completed - exit code: 1 *****

Edit: Here's the content of the file (C:\Users\Antoine\AppData\Local\Adersoft\VbsEdit\Temp\MMNPNCCZ.vbs)

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnport.vbs" -a -r "C70 PS Driver" -h 13.226.51.135 -o raw -n 9200
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs" -a -v 3 -m "Xerox Color C70 PS" -i "C:\Xerox_C70_2014_11\XCC70_5.382.4.0_PS_x64_Driver.inf\x2GITHP.inf" -h "C:\Xerox_C70_2014_11\XCC70_5.382.4.0_PS_x64_Driver.inf"
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs" -a -p "Xerox Color C70 PS" -m "Xerox Color C70 PS" -r "C70 PS Driver"

I have to say, its my first time trying to script this, so yes, I'm new to this. In any case, all comments are welcomed.

Thank you,

1
The syntax/compile time error is in prnport.vbs (or MMNPNCCZ.vbs); you need to publish that. - Ekkehard.Horner
I have added the file. Thank you for your time. - Xeroidian
You are trying to feed command interpreter code to cscript.exe. Use the cscript button to run VBScript code. - Ekkehard.Horner

1 Answers

2
votes

Rename MMNPNCCZ.vbs to MMNPNCCZ.bat. You can't run commands from VBScript like that.

@echo off
rem MMNPNCCZ.bat

cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnport.vbs" -a -r "C70 PS Driver" -h 13.226.51.135 -o raw -n 9200
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs" -a -v 3 -m "Xerox Color C70 PS" -i "C:\Xerox_C70_2014_11\XCC70_5.382.4.0_PS_x64_Driver.inf\x2GITHP.inf" -h "C:\Xerox_C70_2014_11\XCC70_5.382.4.0_PS_x64_Driver.inf"
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs" -a -p "Xerox Color C70 PS" -m "Xerox Color C70 PS" -r "C70 PS Driver"

If you must do it in VBScript you'd need something like this:

' MMNPNCCZ.vbs

Set sh = CreateObject("WScript.Shell")
sh.Run "cscript ""C:\Windows\System32\Printing_Admin_Scripts\en-US\prnport.vbs"" -a -r ""C70 PS Driver"" -h 13.226.51.135 -o raw -n 9200", 0, True
sh.Run "cscript ""C:\Windows\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs"" -a -v 3 -m ""Xerox Color C70 PS"" -i ""C:\Xerox_C70_2014_11\XCC70_5.382.4.0_PS_x64_Driver.inf\x2GITHP.inf"" -h ""C:\Xerox_C70_2014_11\XCC70_5.382.4.0_PS_x64_Driver.inf""", 0, True
sh.Run "cscript ""C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs"" -a -p ""Xerox Color C70 PS"" -m ""Xerox Color C70 PS"" -r ""C70 PS Driver""", 0, True