Start a process

This is used to start a windows process with the given arguments. In the snippet below, set the path to the working directory and the name of the executable.

This script will require adding using System.Diagnostics; to the namespaces section.

Process Proc = new System.Diagnostics.Process();

Proc.StartInfo.WorkingDirectory = "Folder Path";
//Choose the folder path

Proc.StartInfo.FileName = "executable.exe";
//Choose the executable file

Proc.StartInfo.Arguments = "";
//Specify arguments

Proc.StartInfo.UseShellExecute = true;
Proc.StartInfo.RedirectStandardOutput = false;

Using WaitForExit() ensures proper synchronization between the script and the process. Using this will block the current thread and make the script wait for the target process to finish before continuing with the execution flow.

Last updated