A
atlantix
How do you execute a .BAT file from a C# WinForm?
An example would be greatly appreciated.
Thanks,
atlantix
An example would be greatly appreciated.
Thanks,
atlantix
From: "Eliyahu Goldin" <[email protected]>
References: <[email protected]>
Subject: Re: Running a .BAT file from a Windows Form in C#
Date: Mon, 28 Jul 2003 10:44:34 +0200
Lines: 13
Look at class System.Diagnostics.Process, method Start().
Eliyahu
allow/avoid async execution (it really depends on what you are trying toMatteo Taveggia said:Correct. Here is a sample code snippet you can paste into your Main function:
System.Diagnostics.ProcessStartInfo p = new System.Diagnostics.ProcessStartInfo(@"c:\foo.bat");
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = p;
proc.Start();
proc.WaitForExit();
Console.WriteLine("I'm done");
Note: you might tweak it a little bit your code (or batch file) to
rights. Use of included script samples are subject to the terms specified at-Matteo
message are best directed to the newsgroup/thread from which theyhttp://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this