VBScript does not recognize the actual parameter

前端 未结 1 837
[愿得一人]
[愿得一人] 2021-01-27 15:08

I\'ve two VB Scripts. Say First.vbs and Second.vbs.

Frist.vbs calls Second.vbs each time some action/

相关标签:
1条回答
  • 2021-01-27 15:40

    The value of param2 contains a space and you didn't put the parameter between double quotes. Because of that your Run command-line effectively has 3 arguments:

    • Welcome
    • Gokul
    • Nath

    To avoid that add double quotes around your second argument:

    objShell.Run "Second.vbs" & " " & param1 & " """ & param2 & """"
    

    Better yet, quote all arguments and use a quoting function so you don't drown in double quotes:

    Function qq(str)
      qq = Chr(34) & str & Chr(34)
    End Function
    
    objShell.Run "Second.vbs" & " " & qq(param1) & " " & qq(param2)
    
    0 讨论(0)
提交回复
热议问题