Launching Files In DOS Environment
Launching Files In DOS Environment
Using the "Shell" command, you can easily launch files in DOS environment.
Preparations
Add 4 Command Buttons to your form.
Press the first button to Open new DOS window.
Press the second button to Run DOS file.
Press the third button to Run DOS file, and after the file will finish
running the DOS window will closed itself.
Press the forth button to Run DOS file in invisible mode - the user will
not see the DOS window.
Form Code
Private Sub Command1_Click()
Shell ("command.com"), vbMaximizedFocus
End Sub
Private Sub Command2_Click()
' replace c:\windows\arp.exe with the file you want to run.
' the "/k" parameter tell the DOS environment to run the file and not
close
' the DOS window after the file finish running.
' "vbMaximizedFocus" is the state of the DOS window. that's mean the
' DOS window will be maximized.
' instead of "vbMaximizedFocus" you can use the following parameters:
' vbMinimizedFocus, vbMinimizedNoFocus, vbNormalFocus, vbNormalNOFocus,
vbHide
Shell ("command.com /k c:\windows\arp.exe"), vbMaximizedFocus
End Sub
Private Sub Command3_Click()
' the "/c" parameter tell the DOS environment to run the file and close
' the DOS window after the file finish running.
Shell ("command.com /c c:\windows\arp.exe"), vbMaximizedFocus
End Sub
Private Sub Command4_Click()
' vbHide parameter will cause the DOS environment to run in invisible
mode.
Shell ("command.com /c c:\windows\arp.exe"), vbHide
End Sub
|