|
-
Feb 5th, 2013, 08:49 AM
#1
Thread Starter
New Member
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.
-
Feb 5th, 2013, 10:34 AM
#2
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"""
-
Feb 5th, 2013, 11:11 AM
#3
Thread Starter
New Member
Re: Getting an error "Expected end of statement" can somenoe help, I am new to script
-
Feb 5th, 2013, 11:23 AM
#4
Hyperactive Member
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
-
Feb 5th, 2013, 11:24 AM
#5
Thread Starter
New Member
Re: Getting an error "Expected end of statement" can somenoe help, I am new to script
-
Feb 5th, 2013, 11:57 AM
#6
Re: Getting an error "Expected end of statement" can somenoe help, I am new to script
 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.
-
Feb 5th, 2013, 12:03 PM
#7
Hyperactive Member
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!")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|