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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Protecting variables

Status
Not open for further replies.

ErrolDC

MIS
May 26, 2004
72
US
Hi again :)
How do I fully protect a variable that will obviously throw a script error? For example:

Code:
msicall="msiexec /I"\\dfiint-flsvr\data\SAVTools\INSTALL\Symantec Antivirus.msi" INSTALLDIR="C:\Program Files\Symantec AntiVirus" ADDLOCAL=SAVMain,SAVUI,SAVHelp,EMailTools,OutlookSnapin,Pop3Smtp,QClient NETWORKTYPE=1 INSTALLSERVER=0 SERVERNAME=DFIINT-APPSVR /l*v C:\savinst.log REBOOT=Suppress /qn"

Trying to set that install string as a variable throws a script error. I'm not sure how to tell vbscript it's all one single variable.

Errol
 
Try:
Code:
msicall="msiexec /I"&Chr(34)&"\\dfiint-flsvr\data\SAVTools\INSTALL\Symantec Antivirus.msi"&Chr(34)&" INSTALLDIR="&Chr(34)&"C:\Program Files\Symantec AntiVirus"&Chr(34)&"ADDLOCAL=SAVMain,SAVUI,SAVHelp,EMailTools,OutlookSnapin,Pop3Smtp,QClient NETWORKTYPE=1 INSTALLSERVER=0 SERVERNAME=DFIINT-APPSVR /l*v C:\savinst.log REBOOT=Suppress /qn"
 
Another way:
msicall="msiexec /I""\\dfiint-flsvr\data\SAVTools\INSTALL\Symantec Antivirus.msi"" INSTALLDIR=""C:\Program Files\Symantec AntiVirus"" ADDLOCAL=SAVMain,SAVUI,SAVHelp,EMailTools,OutlookSnapin,Pop3Smtp,QClient NETWORKTYPE=1 INSTALLSERVER=0 SERVERNAME=DFIINT-APPSVR /l*v C:\savinst.log REBOOT=Suppress /qn"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Ahh.. thanks very much. This method is very different from bash or korn shell scripting.
 
"" inside a quoted string is the equivalent of \" in shell scripting.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top