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

Logon Issues

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

Using WinBatch in Windows Login Scripts

Keywords: login scripts 

To Launch WinBatch in DOS.BAT from Windows 95/NT Client:

It is often useful to run Compiled WinBatch EXE files as a part of a Windows NT login script. There are a few considerations when doing this.

Windows NT expects the login script to be a DOS-looking BAT file, so you'll need to set up the BAT file to launch your compiled WB EXE file.

Since Windows NT doesn't expect to launch Windows Apps at this point, you'll need to use the start command in the batch file to launch your EXE, usually with the /w "Wait" option, as in the following example:

        REM WINDOWS NT LOGIN SCRIPT
        SET FRED=My Environment variables
        START /W COMPILEDWB.EXE

Question: (Error running compiled program as logon script):

I have created a winbatch file that I would like to use as a logon script file under NT Network. The program runs fine locally from my machine, but when I store it in the Netlogon directory it crashes.

The program is called MIS and it and a DOS batch file run at logon. The batch file checks to see if the DLL file is present in the \Windows directory and copies it there if it's not, then it runs MIS.

This is the error I usually get: MIS caused an invalid page fault in module WBDBP32I.DLL at 0137:1c0375b0.

I have tried redoing the EXE and tried different location for the DLL file.

Answer:

The problem is that the network connection to the NETLOGON directory (where the MIS program is) is remapping during the logon process. This prevents MIS.EXE from referring to the netlogon directory to get its own code. The crash is inevitable.

Perhaps run the MIS.EXE from the DOS BAT file with a:

	START /w mis.exe 
command, and, assuming MIS.exe does not break the connection itself and the connection says open, then it ought to work.

In other cases people just distribute a compile file that looks like:

	; entire source code for mylog.exe
	Call(param1,'')
then compile the real script with the "Encode for calls" option:
	;sample code for login
	Message("Hello","This is a test"
and run it like:
	mylog.exe sample.wbc

To Launch WinBatch in DOS.BAT from Windows 3.11/3.1 Client:

If you try to launch a compiled WinBatch EXE on an NT server from a Windows 3.X client, you will get the error message, "This program requires MS Windows."

The START command is not supported in Windows 3.1/3.11. Your options are more limited here, since you can't run the WB EXE from your DOS batch file. There's a third party utility that might be useful to you, and might still be available, (check with PC Magazine or Ziff-Davis Publishing) called WINSTART, which is a DOS TSR. You'll need to install it on the individual PC, and load it in AUTOEXEC.BAT and your STARTUP GROUP. The limitations are that it will work OK for a single machine implementation, but isn't a good solution if you need to deploy this over a network.

Your other option is to take the WinBatch EXE out of the NT login script, and add the compiled WinBatch EXE in the client PC's Program Manager Startup Group.

How to See Exit Code Returned by WinBatch:

In addition you may find IntControl(1000, p1, 0, 0, 0) (p1 = exit code) useful as it allows you to set the exit code returned by WinBatch, that can then be checked in the login script. (IntControl(1000...) specifies the value returned by WinBatch's "WinMain" (entry point) function.)

Related Threads:

Question:

This has got to be a common question but I haven't been able to find any reference to it in the online help files or in the conferences.

I'm having a problem running a Winbatch script on a Windows 95 workstation which is logging into a Windows NT domain. The script bombs out with the following error.

	WIL EXTENDER ERROR 499:
	UNRECOGNIZED NETWORK ERROR 1245

	username = w95GetUser(@Default)
	Winbatch 32 96M
	WIL Version 2.3 MBN
After cancelling this dialog box, the following message appears:
	Program has performed an illegal operation.
	Invalid Page Fault in module Kernel32.dll
	at 014F:BFF860C8
This WinBatch script works fine if I execute it from Run on the Start Menu.
	\\server\NETLOGON\WINBATCH\WINBATCH.EXE LOGIN.WBT
What is the proper method of executing a WinBatch script from a NT logon session?

Answer:

Not sure. It kind of smells like the connection betwixt your PC and the network drives that your compiled script/DLLs are on is getting broken during login.

Try putting all the pieces local on your PC and see it that helps.

Also not sure is w95GetUser is valid, and the logon process may not have completed yet. I think there might be two unrelated errors.

This bomb is usually as a result of the \netlogon service being disconnected before the WB is finished executing (the wb.dlls are sitting on \netlogon, right?). The easiest way to fix this is to use a start /wait command in the users .bat file. i.e. if my logon script is logon.bat and I want to run wblogon.exe as my script, then logon.bat should do somthing like:

	start /w wblogon.exe

Article ID:   W13518
Filename:   Winbatch in Windows Login script considerations.txt
File Created: 1999:04:15:16:54:34
Last Updated: 1999:04:15:16:54:34