How can I run a VBSfile from [Invoke PowerShell] command?


#1

I want to run a vbscript from powershell with arguments.

Ex]
The path of script : c:/dev/test.vbs
The arguments : arg1 arg2

Could you let me know a correct powershell command?


#2

Slight overkill here - why not use the new Invoke Code activity which allows you to run VB scripts directly.

@Florent_Salendres is your man when it comes to adhoc scripting.

RD


#3

This is how I did it. Powershell script would look like this:

invoke-expression "cmd /C cscript 'filepath.vbs'"

If you want arguments, you need to add arg1 and arg 2 next to the 'filepath.vbs' arg1 arg2
Then create variables at the top in the .ps1 file to store the arguments from UiPath for arg1 and arg2. I’m not sure without looking it up first but there are sources online for using powershell.

Then use Invoke Powershell activity.

Hope that helps. Regards.