What is a .Bat file?

execute bat file

A batch(.bat) file contains a series of DOS commands, and is commonly written to automate frequently performed tasks. These files (.bat) can save time by automating specific actions taken on the computer down to one simple click.

How to create a .Bat file?

In order to create a simple batch file, all you need is a single command you want to run, typed into a text file and saved with the .BAT extension, like "testbat.bat".

The following .bat file create a folder "d:\MyDir" in your D drive. The content of the file as follows :

execute bat file from C# or vb.net

Open a notepad and copy and paste the above content in the notepad and save it as "testbat.bat".

If you want to execute the file directly, double click the file (testbat.bat). Then you can see a new directory in your D drive named "MyDir".

In some situations you have to run .bat files from your C# or VB.Net applications. The following programs shows how to run a .bat file from C# or VB.Net.

Source Code | C#

Source Code | Vb.Net

Start and Kill Processes

Using the Process component, you can obtain a list of the processes that are running, or you can start a new process in the system. The System.Diagnostics namespace provides classes that allow you to interact with system processes, event logs, and performance counters. More about..... Start and Kill Processes

How get Running Process List

How get Running Process List from C# or vb.net

The Process class provides functionality to monitor system processes across the network, and to start and stop local system processes. You can retrieve detailed knowledge of process threads and modules both through the Process class itself. More about...... Running Process List

NEXT.....Rounding to 2 Decimal Places