?
Solved

login script to run an exe file while logging on

Posted on 2006-03-31
8
Medium Priority
?
13,353 Views
Last Modified: 2012-11-12
Hi all
I am running windows server 2003 ent edition with AD.  I use 'login.bat' to install and map all the network drives.  I have an '.exe' file which I want to run while any user logs in.  How can I do that through my 'login.bat' or any other way through the AD.
Thanks
0
Comment
Question by:amanzoor
8 Comments
 
LVL 19

Assisted Solution

by:jss1199
jss1199 earned 292 total points
ID: 16344949
Hi amanzoor,

Use the Call commmand.

CALL C:\yourprogram.exe

If there are spaces in the path use:

CALL "C:\Program Files\yourprogram.exe


Cheers!
0
 
LVL 97

Assisted Solution

by:Lee W, MVP
Lee W, MVP earned 568 total points
ID: 16344951
Just put it in.  Have you tried that?
0
 
LVL 5

Accepted Solution

by:
shankshank earned 288 total points
ID: 16344956
in your login bat, add this line

call c:\DIR\NOTEPAD.EXE



of course, change c:\dir\notepad.exe to the executable you desire to run.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Assisted Solution

by:miloudi
miloudi earned 284 total points
ID: 16344965

Try it on test user first.

the location server followed by the exec
e.g:
\\opfile\scanreg.exe
0
 
LVL 97

Assisted Solution

by:Lee W, MVP
Lee W, MVP earned 568 total points
ID: 16344966
CALL is typically used for batch files - I've not see it used with EXEs.

If the EXE is hanging the logon script because it continues to run, then use the START command -

START yourprogram.exe

Or

START "C:\PATH\TO\YOUR\PROGRAM.EXE"
0
 
LVL 2

Assisted Solution

by:matricii
matricii earned 284 total points
ID: 16346827
leew is correct.

CALL is used for batch files in batch files.  In order to use the program you would use the START command.  This will allow the program to run (like a TSR).
0
 
LVL 18

Assisted Solution

by:Sam Panwar
Sam Panwar earned 284 total points
ID: 16348045
Hi.
- Create a batch file called "netlogon.bat" in this folder:
  "c:\documents and settings\all users\start menu\programs\startup"
- Create a batch file \\YourServer\SomeShare\login.bat
- Put these lines into it:
  @echo off
  \\YourServer\SomeShare\psexec.exe  \\PC1 c:\Tools\SomeCommand.exe

OR
@echo off
net use x: \\ace-file01\SHARED
if exist x:\InventoryData\AceAssets\clientcon.exe
    x:\InventoryData\AceAssets\clientcon.exe
(unwrap this line!)
net use x: /d

- On PC2..9, create a task under the Task Scheduler to
  invoke \\YourServer\SomeShare\login.bat.
- Tell the Task Scheduler to run the task at logon time.

Note that you must schedule the task under and account
name / password that is valid on PC.

You can get psexec.exe from www.sysinternals.com.It's free.

- Put the following lines into netlogon.bat:

Other scripts sites:

http://cwashington.netreach.net/
http://groups.google.co.in/group/microsoft.public.scripting.vbscript/browse_thread/thread/ae838fbba0318261/16745137725cbadf?lnk=st&q=login+script+to+run+an+exe+file+while+logging+on&rnum=1&hl=en#16745137725cbadf
0
 
LVL 5

Expert Comment

by:Dawilliams
ID: 16400422
leew , matricii, are correct Call would leave the logon.bat hung until the exe that was called ended all that is needed is the start c:\???.exe
thereby ending the logon.bat after starting the exe
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

WARNING:   If you follow the instructions here, you will wipe out your VTP and VLAN configurations.  Make sure you have backed up your switch!!! I recently had some issues with a few low-end Cisco routers (RV325) and I opened a case with Cisco TA…
Tech spooks aren't just for those who are tech savvy, it also happens to those of us running a business. Check out the top tech spooks for business owners.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question