create a batch file to run an exe file once

Hi All,

I have a windows 2000 server which runs a log in script in ad for clients to map drives.  I need to install an exe file on all of the machines in the network.  I would like to run this exe file automatically in the log in script.  I was told I need to create a batch file to call the exe file and then that batch file from the login script.  I also only want this exe file to run only once on each machine.  Can anybody help?

Many thanks,

Who is Participating?
Shift-3Connect With a Mentor Commented:
You could have the install process generate a file and then check for its presence like so:

if not exist c:\SoftwareInstalled.txt (
 call "\\server\share\installer.exe"
 echo Done. > c:\SoftwareInstalled.txt

Keep in mind that anything in a logon script runs under the user's credentials, so if the .exe requires administrator rights then it won't work correctly for normal users.
krawz187Connect With a Mentor Commented:
This is perhaps not the prettiest or most reliable way, but maybe it will give you a starting point.  It would be much better if you had some error handling in it, but I'm not as experienced with scripting as I'd like to be.


@echo off
REM ########## Run EXE File (once)

mkdir %SystemDrive%\install
if exist %SystemDrive%\install\EXE_file1_Finished.txt goto NOinstall
call %LOGONSERVER%\netlogon\Script2.cmd


@echo off
xcopy /YHRC %LOGONSERVER%\netlogon\File1.exe %SystemDrive%\install\
%SystemDrive%\install\File1.exe /<SilentInstallSwitches>
xcopy /YHRC %LOGONSERVER%\netlogon\EXE_file1_Finished.txt %SystemDrive%\install\
Forced accept.

Community Support Moderator
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.