How to Connect to Server via DOS batch files
DOS batch PIF connect to server
Running DOS batch files from WinBatch:
Now, generate the parameters you need to pass to your DOS batch file. You can ask your user for them, browse for them, or simply define them as constants. You could set them up as follows:
- First, write your DOS batch file. You might combine several batch files into one that you can run from Windows with WinBatch. Make use of passed parameters. Use passed parameters (%1 %2 %3, and so on) to handle items like server names, user names, and passwords.
- Make sure that the DOS batch file works reliably.
- Write a WinBatch batch file that runs the DOS batch file. You must use the Windows enhanced mode in Win3.1/3.11 for this to work.
FIRST="OURSERVER" SECOND="OURUSER" THIRD="PASSWORD" ETC="ANOTHERVALUE"Then run the batch file from WinBatch in the following way. You can change the RunWait to RunHideWait after you are certain this batch file works well.RunWait("C:\PATH\BATFILE.BAT", "%FIRST% %SECOND% %THIRD% %ETC%")Next, write a Windows PIF file to control how your DOS batch file is handled by Windows. See below for suggested PIF settings. Use the Windows PIFEDIT.EXE program located in your Windows 3.1/3.11 directory.You MUST give your PIF file the same root filename as your DOS BAT filename. If you do this, Windows will check the PIF file before running the DOS batch file and will use the settings in the PIF. You do not have to run the PIF file from WinBatch directly, but if you do, it will work just fine.
Use the following settings in your PIF file:
Check the "Close Window on Exit" box. Set the "Display Usage: Windowed" radio button. The other settings can be left at their default values.Next, give the PIF file the name of your DOS batch file and save it in your Windows directory.If all goes well, you can change the function RunWait() to RunHideWait(). Then, run your WinBatch script and make sure it works as intended.
Article ID: W13476Filename: Connect to Servers via DOS batch files.txt