How to Run DOS Commands in VB.Net

Written by jim campbell
  • Share
  • Tweet
  • Share
  • Email

The VB.NET "System.Diagnostics.Process" class contains the functions and properties needed to send console commands to the Windows MS-DOS command line utility. You use MS-DOS commands in VB.NET applications that run in the console. These applications change settings on a computer, fix driver issues or check the directory for missing system files.

Skill level:


  1. 1

    Click the Windows "Start" button and type "visual studio." Press "Enter" to open the VB.NET programming software.

  2. 2

    Open the VB.NET project file. After the project file loads, double-click the code file you want to use to send commands to the console.

  3. 3

    Add the following library file to the top of the VB.NET code file:

    imports System.Diagnostics.Process;

    This library class file imports all of the necessary functions to call the console commands.

  4. 4

    Type the following code to send commands to the DOS prompt:

    Process proc = Process.Start();

    p.StandardInput.WriteLine(@"cd windows");

    This is the "change directory" command. It changes the command prompt focus to the "windows" directory. You can use any command in the "WriteLine" function to send to the prompt.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.