Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help I am trying to Run a VBScript inside VBScript

Status
Not open for further replies.

danpwhite

IS-IT--Management
Sep 26, 2014
3
US
I have a vbscript that works just fine, I would like to know how I can run this script in side of it.
cscript prnmngr.vbs -ac -p "\\COL-FPS01\cae_adams"
cscript prnmngr.vbs -ac -p "\\COL-FPS01\CAE_CHECK"
cscript prnmngr.vbs -ac -p "\\COL-FPS01\CAE_BUCHANAN"
cscript prnmngr.vbs -ac -p "\\COL-FPS01\CAE_CLEVELAND"
 
This is what we run, and it does not work. getting unable to add printer connection win32 error code 1722

'Call Microsoft PrinterScript for Printers
Dim objShellSet objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "%comspec% /k cscript ""\\caena2240-1b\groups\deleted weekly\wboling\prnmngr.vbs"" -ac -p \\col-pfs01\cae_adams", 1, True
 
Still Fails

Dim objShellSet objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "cmd /k cscript prnmngr.vbs -ac -p "\\COL-FPS01\cae_adams
 
I know you said prnmgr.vbs is working, but it sounds like that's where the error is coming from. What happens if you type 'cmd /k cscript prnmngr.vbs -ac -p "\\COL-FPS01\cae_adams"' into a run prompt? Or 'cscript prnmngr.vbs -ac -p "\\COL-FPS01\cae_adams"' into a command line? What if you put a message box at the top of prnmgr.vbs to verify that it is being launched? Off hand I'd say that it could be an issue calling with cscript instead of wscript, an issue with the quotes in the string, or possibly a path issue, though I would expect a 'file not found' error for that one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top