Link to home
Create AccountLog in
Avatar of JeffBeall
JeffBeallFlag for United States of America

asked on

windows 7 startup batch

I want to have a batch file run for everyone that logs into a windows 7 pc.
I put my batch in
C:\ProgramData\Microsoft\Windows\Start Menu
but to test it, i had someone else login to the computer, but the batch didn't run
if that person that signed in goes to
C:\ProgramData\Microsoft\Windows\Start Menu
and double click on the batch file, it works
Any ideas why it doesn't automatically run?
ASKER CERTIFIED SOLUTION
Avatar of Steven Carnahan
Steven Carnahan
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of JeffBeall

ASKER

wow, i feel like an idiot! I was just plopping my batch in the start menu, not the startup folder!
That did the trick, thank you.
JeffBeall--The command you are using will only open the Start Menu.  It will not start up the programs in the Start Menu.  
I do not understand what you want the batch file to do.
The location for Startup posted by pony10us is correct, but once again will only open the Startup folder, not start the programs is the folder.  
There are many locations that start programs at boot.  
To name a few

1. HKEY_LOCAL_MACHINE\Software\ Microsoft\Windows\CurrentVersion\Run
2. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
3. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run
4. the "load=" line in the [windows] section in C:\Windows\WIN.INI
5. the "run=" line in the [windows] section in C:\Windows\WIN.INI
6. HKEY_LOCAL_MACHINE\Software\ Microsoft\Windows\CurrenTVersion\ RunServices
7. HKEY_CURRENT_USER\Software\ Microsoft\Windows\CurrenTVersion\Run
8. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
9. C:\Windows\AllUsers\StartMenu\ Programs\Startup
10. C:\Windows\StartMenu\Programs\ Startup
11. C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

For 64-bit Windows 7 only:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run
AND
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\RunOnce
Sorry, I didn't see your entry.
I put my batch file in

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

and it does run when someone logs in.
It's just a simple batch that runs this command

rundll32 printui.dll,PrintUIEntry /y /n "\\apc001\D01MIS01Z1"

which changes the default printer to D01MIS01Z1 which is on server apc001
Actually, I gave the quick easy answer based on your trying to put it in the startup folder to begin with.  That is an old method of doing it that is still used a lot today.  However as jcimarron pointed out, there are several other methods available to accomplish the same task.
so i played around and put a reg entry in

HKEY_LOCAL_MACHINE\Software\ Microsoft\Windows\CurrentVersion\Run

and that works fine too. So is there some advantage to using the registry instead of the startup folder?
One advantage to using the registry is that the executable can reside anywhere on the system. You just need to either have the location in the path statement or use the full path to the executable in the reg entry.

For example, I may want to have a single folder for all my batch files. I could keep that file in this folder and point the reg entry to that folder to execute it at startup.  That way I always know where to find any of my batch files instead of hunting all through the system.