VBScript Help! RRS feed

  • Question

  • Set args = WScript.Arguments
    Wscript.echo args.Item(0)
    Dim ps: ps = "Powershell.exe -Command & 'C:\test\test.ps1'abc"
    Dim sh: Set sh = CreateObject("WScript.Shell")
    Dim exec: Set exec = sh.Exec(ps)

    '-- Close standard input before reading standard output!
    WScript.Echo exec.StdOut.ReadAll()

    I Have above Script which calls test ps1 script which accept one argument "abc"which is harcode value , Now i want to pass the args.Item(0) value in place of abc

    Please help me and tell how to replace line 3

    Tuesday, June 12, 2012 5:26 AM

All replies

  • If all the above actually works (i.e. the WScript.Echo displays the argument correctly, and the command works correctly), I would try

    Dim ps: ps = "Powershell.exe -Command & 'C:\test\test.ps1' " & args.Item(0)

    Mobile OWA For Smartphone
    email a@t leederbyshire d.0.t c.0.m

    Tuesday, June 12, 2012 1:21 PM