If you have a DOS application that you would like to run out of VB and be able to place the required switches in how would you do it in VB.
Example DOS app:
dosapp -something -something else
Any ideas would be great.
Printable View
If you have a DOS application that you would like to run out of VB and be able to place the required switches in how would you do it in VB.
Example DOS app:
dosapp -something -something else
Any ideas would be great.
Use the VB Command function
Syntax: x = Command()
Here's a VB Help explanation:
quote: "Returns the argument portion of the command line used to launch Microsoft Visual Basic or an executable program developed with Visual Basic."
Hope this helps :)
So would you place the syntax that you place in the command into a string or how would this work?
Put this code into VB.
Now run it from DOS like this:Code:Private Sub Form_Load()
MsgBox Command
End sub
C:\>MyApp.exe -Hello
Now when you run the program, it will display a messagebox with -Hello in it.
I appreciate your insight, is there a way to run it without having to manually fill in the information at the command line? This will be going out to users that have no clue how to write at the command line.
Thanks
Hmm, what do you want to have done brian? Have the user enter a command line, (you could as well do it with run in startmenu) or have it ask you them in runtime?
Are you looking for an example? :rolleyes:
This works as like, if a user were to go into dos, type:Code:Private Sub Form_Load()
Select Case Command
Case "/k"
MsgBox "Paramater = /kedaman"
Case "/m"
MsgBox "Paramater = /Megatron"
Case Else
MsgBox "Usage:" & vbCrLf & vbCrLf & "/k - kedaman" _
& vbCrLf & "/m - Megatron"
End Select
End Sub
C:\MyDir\MyProgram.exe /k
A msgbox would come up saying kedaman.
C:\MyDir\MyProgram.exe /m
A msgbox would come up saying Megatron.
Case Else
Is if nothing is if nothing or the wrong command lines are typed.
You may also want to hide your program since Windows actually loads it.
Notice: Your program will only work when Windows is loaded and the Windows DOS is used.