Getting an error "Expected end of statement" can somenoe help, I am new to scripting.
I am trying to install the MQv7 fix pack and I am getting an error that says Expected end of statement on line 7 Char 99. Can someone help me to fix this? Below is my code
On Error Resume Next
Set sho = Wscript.CreateObject("Wscript.Shell")
'strCurrentDir = Left(Wscript.ScriptFullName, (InstrRev(Wscript.ScriptFullName, "\") -1))
strcmd = "\\ServerName\Applications\MQSeriesv7.0\Fix\Fix7019\WebSphereMQMDV7.0.1.9EnUs.exe" -s -a MQPLOG="C:\Temp\UPDATEINSTALL.log" MQPBACKUPPATH="C:\Program Files (x86)\IBM\WebSphere MQ\Maint_1.9" MQPSILENT="1"
Hope you can help, thank you.
Re: Getting an error "Expected end of statement" can somenoe help, I am new to script
You have several quotes in there. When assigning a string value it must be enclosed in quotes so when it gets to the second " in that line it expects that to be the end of the assignment
You have quotes in your string so you need to double them up to let the compiler know that you want those quotes in the output string
Code:
strcmd = """\\ServerName\Applications\MQSeriesv7.0\Fix\Fix7019\WebSphereMQMDV7.0.1.9EnUs.exe"" -s -a MQPLOG=""C:\Temp\UPDATEINSTALL.log"" MQPBACKUPPATH=""C:\Program Files (x86)\IBM\WebSphere MQ\Maint_1.9"" MQPSILENT=""1"""
Re: Getting an error "Expected end of statement" can somenoe help, I am new to script
Re: Getting an error "Expected end of statement" can somenoe help, I am new to script
Better option, surround it with chr(34), which is a quote litteral and makes it much easier to read than all the quotes.
Code:
strCmd = chr(34) & "\\My\server\path\here\" & chr(34)
By the by, wrong forum
Re: Getting an error "Expected end of statement" can somenoe help, I am new to script
Re: Getting an error "Expected end of statement" can somenoe help, I am new to script
Quote:
Originally Posted by
wakawaka
Better option, surround it with chr(34), which is a quote litteral and makes it much easier to read than all the quotes.
Code:
strCmd = chr(34) & "\\My\server\path\here\" & chr(34)
By the by, wrong forum
or define it as a const and use the const.
Re: Getting an error "Expected end of statement" can somenoe help, I am new to script
That or define a function:
Code:
Function Quote(ByVal string)
Quote = chr(34) & string & chr(34)
End Function
usage:
Code:
strCmd = Quote("This is my string quoted!")