How to run a batch file at system startup like autoexec.bat in DOS

This NT question comes up so frequently I added this to the list of citrix helps and hints.

The best way I have found to do this is to get the freeware utility Autoexnt.zip by Jan van Eekeren, The Netherlands.  It runs as a service.

Extract the file and follow the directions on how to install it as a service in the autoexnt.txt file.  In order for it to work correctly for me I had to in the control panel-services-autoexnt-startup  choose allow service to interact with desktop and put in an account that had system access.

I made a batch file that disables logins,  deletes all of the files from the temp directory and the leftover print jobs from the wtsrv/system32/spool/printers directory recopies a clean copy of the Netscape users preferences and then reenables logins.  You of course can do this with a kix script but those of us from the old dos school will appreciate this way even better.

How do I execute a batch file or program at logoff?
Thanks to Rick Mack for this Suggestion

For winframe(NT 3.51), get a copy of nwlogout from www.tricerat.com. While this was originally intended for cleaning up netware connections on logout, it works fine for just about anything else, since what it does is trap the logout API call, and run a script of your choosing.

Metaframe(WTS, 2000) is even easier. If you have a look at the values under the key: HKLM\software\Microsoft\Windows NT\CurrentVersion\Winlogon you'll find a string value "LogoffApp". If the key is not there you can add it as a RegSZ value. At the moment, the only program run at logoff (besides the winlogon cleanup) is ctxlogof.exe. If you insert your batch file name in front of ctxlogof (comma delimiter) it will be executed at logout time.

Disclaimer: This information is supplied as is and is intended for information purposes only. Use this information at your own risk. The internet can often contain false or misleading information. While this is generally not the case with my personal documents I have to put this text here for legal purposes.

Featured Links