Results 1 to 7 of 7

Thread: Getting an error "Expected end of statement" can somenoe help, I am new to scripting.

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    3

    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.

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    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"""

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    3

    Re: Getting an error "Expected end of statement" can somenoe help, I am new to script

    Thank you.

  4. #4
    Hyperactive Member
    Join Date
    Jan 2010
    Posts
    259

    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

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    3

    Re: Getting an error "Expected end of statement" can somenoe help, I am new to script

    Thank you

  6. #6
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Getting an error "Expected end of statement" can somenoe help, I am new to script

    Quote Originally Posted by wakawaka View Post
    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.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  7. #7
    Hyperactive Member
    Join Date
    Jan 2010
    Posts
    259

    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
  •  



Click Here to Expand Forum to Full Width