passing a single cmd line argument to a vbs script in PS RRS feed

  • Question

  • Hello,

    I have been trying to create what should be a really simple powershell command from this current cmd line command:

    C:\Install\PkgSrc\ExPutty\3.0\Scripts\setup.vbs inst=4

    This command will run the setup.vbs, with the inst=4 switch making the .vbs uninstall the ExPutty program.

    I can't get the inst=4 switch to work in powershell.

    I have tried:

    param ([string]$value1 = 'inst=4') cmd.exe /c C:\Install\PkgSrc\ExPutty\3.0\Scripts\setup.vbs $value1   

    The setup.vbs ran, but didn't uninstall the program.  I then tried the following:

    cscript C:\Install\PkgSrc\ExPutty\3.0\Scripts\setup.vbs inst=4

    This also ran without error, but it didn't uninstall the program.  I just need to pass this static inst=4 switch to the .vbs program, but am not sure what I am doing wrong.  I was reading about wscript as well, but that seemed like overkill for this non changing switch I am trying to pass.

    Thanks, Eli

    • Moved by Bill_Stewart Monday, December 17, 2018 6:32 PM Unanswerable drive-by question
    Monday, October 1, 2018 7:40 PM

All replies

  • A switch for VBS looks like this:  setup.vbs /inst 4

    "inst=4" is passed as a single value.

    You don't need or want "CMD"

    C:\Install\PkgSrc\ExPutty\3.0\Scripts\setup.vbs $value1   


    Monday, October 1, 2018 7:49 PM
  • Thanks for the reply jrv.  I tried using the following:

    cscript c:\Install\PkgSrc\ExPutty\3.0\Scripts\setup.vbs /inst 4

    It ran without error, but never passed the inst=4 switch, because it didn't actually uninstall the ExPutty program.  Maybe I misunderstood what you meant.

    thanks, eli

    Monday, October 1, 2018 9:50 PM
  • Without the VBS there is no way to determine what is happening.


    Monday, October 1, 2018 9:52 PM