Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run VB exe in batch mode from DOS 1

Status
Not open for further replies.

Neera

MIS
Nov 9, 2000
10
US
I need to run VB exe. The use wants to put it in a schedules where the input and output file will be passed as a parameter on the DOS line with run statement.

For example like this:

D:\>rriscrub9 [path\input table] [path\output table]


Can VB run this way??????????
 
You Betcha!
Run Line: C:\MyExe.exe C:\MyFile.txt D:\YourFile.txt
In your VB.exe


Dim strInFile As String
Dim strOutFile As String
strInFile = Left(Command, InStr(Command, " ") - 1)
strOutFile = Mid(Command, InStr(Command, " ") + 1)
 
The processing of the file is in a click event. Now because the input/output file is passed on the command line, I would like to process the file without the user interface. In which event the code should be to process the input file and create the output file??????/
 
If it is running in Batch mode, you can not rely on any click events. Put the code in a mod and have the program start with sub main rather than a form at startup. From the main, call the code that will process your data. - Jeff Marler B-)
 
To add to Jeff's:
I have some automated programs like this, and they are scheduled to run once a day(whatever). However, sometimes they need to be run again for some reason (like a server/network was down, newer data has been received, etc), and the App needs to be run manually(w/GUI). So...

Sub Main()
if Command <> &quot;&quot; Then
Dim strInFile As String
Dim strOutFile As String
strInFile = Left(Command, InStr(Command, &quot; &quot;) - 1)
strOutFile = Mid(Command, InStr(Command, &quot; &quot;) + 1)
DoProcessing(strInFile, strOutFile)
Else
frmMainForm.Show
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top