Spawning A Process in C#

C# Spawn Process Example

The sample application has two parts. The first part starts a notepad process when you click the ‘Start’ (Marked as 1) button. You can enter the text document location in the text box (Marked as 2) before clicking the start button. When a text document is specified, the notepad process opens that document.

In the second part, the example app runs the batch as a process when we click the start button (Marked as 7). The batch file performs a ‘DOS Copy’ operation, which requires Source and Destination locations. We can supply these data can through two text boxes (Marked as 3 & 4). When a batch file execution continues, we can see a console window in the background. The checkbox ‘Make Silent’ (marked as 5) suppresses the background command window. The checkbox ‘Notify when closed’ (Marked as 6) when checked, allows the application receiving the notification when process finished its operation. In our case, when the batch file completes the copy action, our example gets a notification.

Read More