We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

login script to run an exe file while logging on

amanzoor
amanzoor asked
on
Medium Priority
15,214 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
Comment
Watch Question

Commented:
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!

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Lee W, MVPTechnology and Business Process Advisor
CERTIFIED EXPERT
Most Valuable Expert 2013
Commented:
Just put it in.  Have you tried that?
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.
Commented:

Try it on test user first.

the location server followed by the exec
e.g:
\\opfile\scanreg.exe
Lee W, MVPTechnology and Business Process Advisor
CERTIFIED EXPERT
Most Valuable Expert 2013
Commented:
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"
Commented:
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).
Sam PanwarSr. Server Administrator
Commented:
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
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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.