WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Networks - Servers
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Connect to Server via DOS batch files

DOS batch  PIF connect to server 

Running DOS batch files from WinBatch:

  1. 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.
  2. Make sure that the DOS batch file works reliably.
  3. 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.
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="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:   W13476
Filename:   Connect to Servers via DOS batch files.txt
File Created: 1999:04:15:16:54:16
Last Updated: 1999:04:15:16:54:16