Skip to main content

Posts

Showing posts from December, 2013

VB.NET Run DOS Command

VB.NET  Execute DOS Command

How to execute command line using VB.NET?

Quick Snippet to Run a DOS Command executable file

Let's take an example using iexplore.exe and shutdown.exe command.

Iexplore.exe which is located on program files folder.

To verify the file open windows explorer and go to Program Files select Internet Explorer folder.

Or via command line press "Windows key +R" and type "cmd" on the text box  and press enter. It will open a command prompt window.

In command prompt window:

Type: cd \progra~1\Internet Explorer and press enter.

type: Iexplore.exe cnn.com (this will open a web page for cnn.com)

Using the shutdown command:
type: Shutdown /R /F /T 07 (reboot the computer and force open files to close within 7 seconds)

It's quite straight forward to use those commands via the command prompt but how to execute those command lines using VB.Net?

Maybe the first thought is to create a string with the command  and call the string with "process.…