none
VBScript questions newbie, &, "", Chr(34) ...

    Question

  • Hi,

    I need to modify some vbscripting but I'm really new to it.

    Bottomline, I’m mixed up with the “”, the & and the Chr(34). How can I read/debug the output? The script just throws an error on the line, but then I’m stuck. What comma &, Chr(34) to add or remove? If I would know what the output was, I could adapt some lines.

    This is the code:

    SubRunCmd "Install Mypackage", "", Chr(34) & sProgramFiles & "\Common Files\Adobe AIR\Versions\1.0\Adobe AIR Application Installer.exe" & "-silent", "", Chr(34) & sSourcePath & "\setup.air", "install"

    Please advise,

    J.


    Jan Hoedt

    Monday, September 09, 2013 12:05 PM

Answers

  • I'm going to guess that you just need to balance the Chr(34) characters in the correct places, as below:

    SubRunCmd "Install Mypackage", "", Chr(34) & sProgramFiles & "\Common Files\Adobe AIR\Versions\1.0\Adobe AIR Application Installer.exe" & Chr(34) & " -silent", "", Chr(34) & sSourcePath & "\setup.air" & Chr(34), "install"

    This assumes the SubRunCmd method takes 6 parameters. Also, note that "" is a Null string, not a space character. I also added a space in front of the string "-silent".


    Richard Mueller - MVP Directory Services

    • Marked as answer by janhoedt Wednesday, September 11, 2013 3:26 PM
    Monday, September 09, 2013 1:24 PM
    Moderator

All replies

  • From a purely VBScript point of view, there's no syntax error in what you posted, though logically it looks like you have some problems.

    Please post the definition of the SubRunCmd routine, as it will be easier to identify the problem if we can see how many arguments that routine is supposed to receive, and what data should be in each one.

    What you're currently doing is sending 6 arguments to that routine.  In two of the arguments, you have opening quotation marks embedded in the string (that's what the Chr(34) represents), but no closing quote.  While that's legal VBScript code, it probably won't work the way you intended.

    Monday, September 09, 2013 12:17 PM
  • Thanks. Actually, the only thing I want to do is the following:

    "C:\Program Files\Common Files\Adobe AIR\Versions\1.0\Adobe AIR Application Installer.exe" -silent "\\mynetworkpath\forceexplorer.air"

    I'm pretty sure the first part is ok but the last part & "-silent", "", Chr(34) & sSourcePath & "\setup.air", "install" the double ", the Chr(34), the , ... I'm somewhat mixed up.


    Jan Hoedt

    Monday, September 09, 2013 12:37 PM
  • You are trying to use vbscript at a command line.  This will not work.

    Of course if you are trying to use a run command in vbscript then just do this:

    strCmd="""C:\Program Files\Common Files\Adobe AIR\Versions\1.0\Adobe AIR Application Installer.exe"" -silent \\mynetworkpath\forceexplorer.air"

    It is alone string.  On each element that requires quotes use two quotes.  The beginning and end of the string may end up with three quotes but that is as expected.

    The last piece with the share path does not need quotes.  Quotes are only needed when there are spaces in an element.

     


    ¯\_(ツ)_/¯


    • Edited by jrv Monday, September 09, 2013 1:19 PM
    Monday, September 09, 2013 1:17 PM
  • I'm going to guess that you just need to balance the Chr(34) characters in the correct places, as below:

    SubRunCmd "Install Mypackage", "", Chr(34) & sProgramFiles & "\Common Files\Adobe AIR\Versions\1.0\Adobe AIR Application Installer.exe" & Chr(34) & " -silent", "", Chr(34) & sSourcePath & "\setup.air" & Chr(34), "install"

    This assumes the SubRunCmd method takes 6 parameters. Also, note that "" is a Null string, not a space character. I also added a space in front of the string "-silent".


    Richard Mueller - MVP Directory Services

    • Marked as answer by janhoedt Wednesday, September 11, 2013 3:26 PM
    Monday, September 09, 2013 1:24 PM
    Moderator