How to Run an EXE File in VB Code
- 1). Load the Visual Studio development program from the "Start" menu.
- 2). Create a new Windows Forms project, give it a useful name and choose an appropriate file location.
- 3). Create a new button in form 1 and call it "cmdshell."
- 4). Double-click on the newly created "cmdshell" button to bring up the code window for it.
- 5). Use the "shell" function to run an exe file; you must enclose the exact path to the exe file in double quotes and brackets. An example of the code would be as follows:
"Shell("c:\windows\notepad.exe" , AppWinStyle.NormalFocus)" - 6). Run the program by pressing F5 and click the button on the form to load the exe file specified in the code.