How to Run DOS Commands in VB.Net

Save

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.

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

  • 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.

  • 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.

  • 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.

References

Promoted By Zergnet

Comments

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!