Call vbs in UIpath

Can I get the best approach to invoke vbs file with configurable parameter in UIpath.
I am seeing powershell and invoke code as 2 ways. suggest me which approach is suggested

1 Like

We’re using PowerShell invokes for it currently.
Haven’t tried InvokeCode for that yet.

A 1st-party direct activity would be best (f.e. in Script package). I wouldn’t be surprised if there’s already a multitude of in-house implementations of it in different companies, which is a waste of everyone’s resources.

Added to Ideas, but let’s continue the discussion - I’m also curious what’s the split between PS and InvokeCode for this one.


I used Start Process in the past



How do you get outArgs? Via exit code?

thanks for the approach. can u share a sample vbs code as I see my regular vbs files are not getting executes
is any modification needed to suite UIpath

My processes does not return any value. It basically does some business logic and sends out an email or if it is an already existing ticket will mark the email as UnRead. The script takes about 15-20 minutes to execute, robot will be looking for that specific email to execute downstream logic.I don’t think we can get Output args or use exit code in this approach.We might if we use System.Diagnostics.Process.Start.

1 Like

Thanks for the sample. It helped me to understand the approahch.
I am not familiar with vbscript.
On eexecuting the above scripts I am getting Microsoft compilation error. Is there some changes needed int he script to run from UIPath

I was finally able to figure out it as some syntax error in scrit…sorted it out

i got the clarity to use start process for invoke of vbs. also we can pass input argument. if output argument is needed are we to prefer powershell
if we go with System.Diagnostics.Process.Start if there any specific end process needed

Process.Start was just my assumption, I think it is preferable to go with PS.

This may be a bad idea, but did you check out the Invoke VBA activity in latest Excel package?






Thanks for suggesting. I will try this approach…
As of now I am able to pass multiple input argument to invoke VBS from Invoke code but not output argument :frowning: …

System.Diagnostics.Process.start(“C:\Test\SecondVBScript.vbs”,Number1 &" “& Number2 &” "& Total)

I have not tried before, but I get below output value



   String cmd = String.Format("C:\temp\test.vbs 1 2")
     Process process = new Process();
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.RedirectStandardOutput = true;
    process.StartInfo.CreateNoWindow = true;
    process.StartInfo.FileName = "cscript.exe";
    process.StartInfo.Arguments = cmd;



First of all thanks for providing multiple options. I am getting empty result at this time. will try to diagnose the issue and post my responses

Hello Everybody,
pls forgive me for a lama question! This code (process.StartInfo.RedirectStandardOutput etc) is an UiPath code? I am new to UiPath, and i found only diagrams, Flowcharts…So, is it possible to write CODE in UiPath?
Thabk you!