start a batch file from a vb app
Posted on 1998-10-20
Hello friends !!
I am struggling with the problem as described here under:
I use a software application which runs under Dos ON MY File and Database Server using NT 4.0 ( I first have to open a Dos box on my Server).
Every part of the application has it's own batch file to start with.
Example of the contents of one of the batch files is called Grd200.bat and hereunder are it's contents:
@ECHO OFFCALL acc9_env.batrem SET PRNTOUT=PRINTERIF EXIST %eigen%\grd200 call %bat%\delete.bat %eigen%\grd200SET PRNTOUT=%eigen%\grd200
CALL %bat%\execute GRD20025
This starts a program ( GRD20025 ) which can handle product number maintenance.
What I normally do is the following:
Click on the Dos prompt and a Dos box is opened.
Start the batch file by typing it's name ( name = GRD200.bat ) and hit the Enter key.
Now I can work with the application that starts with this batch file; after exiting the application I come in my dos prompt again
I type EXIT and Windows is 'on the run' again.
I wanted to write a Menu application for this because starting up all these batch files under dos is not a workable situation for a user. Therefor I have developed an application with Visual basic 6.0 and have build a Menu with the Menu Editor ( MDI form ).
From that Menu I start a batch file with the following purpose:
Open a Dos box and start start the batch file (GRD200.bat)
Shrink the VB application ( show it down under on the task bar as an icon )
After exexcution of the contents of the batch file: close my Dos box again ; enlarge my VB Menu application again.
Herewith is a print of the code as used; however : something happens but my batch file doesn't seem to be started; I never get the application ( see batch file ) running;, so:
Who can help me writing the right VB code for this problem?? Code:
Private Sub MenGrb200_Click()
Rem: opstarten vanuit directory op Server Bl3: U:\Acc9\Bats\Grd200.bat
Rem: U is directory on my File Server were all batch files ar located
A = Shell ("U:\Acc9\Bats\Grd200.bat ", 3)
The Batch file starts but the parameters are not set nor is the exe started. I know this must be possible since a shortcut works and if I do it by hand it works as well. Perhaps there is somebody out there who knows an Api call or an other way to solve this.
Any help will be highly appreciated.
Thanks in advance