Running Batch File in background when windows boots up
Asked Answered
L

5

26

How do I run a batch file each time windows boots up also I need to run it in the back ground(without that command window getting displayed)? I use Windows Xp. My actuall requirement is I want to start the Tracd server using the command line commands whenever Windows boots up.

Lactoflavin answered 14/11, 2008 at 8:25 Comment(0)
E
33

Add your program in the registry:

Run - These are the most common startup locations for programs to install auto start from. By default these keys are not executed in Safe mode. If you prefix the value of these keys with an asterisk, *, is will run in Safe Mode. Registry Keys:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run registry key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run registry key 

Then you can launch your batch in an invisible mode:

wscript.exe "C:\yourpath\invis.vbs" "your_file.bat"

In invis.vbs put...

CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
Elisavetgrad answered 14/11, 2008 at 8:29 Comment(0)
S
14

Two other startup posibilties:

  • you could always add the bat file to the startup folder,
  • or start it as a Scheduled task setting to run on logon.
Superdominant answered 14/11, 2008 at 9:27 Comment(2)
I want to run it without the command window gettng popped up.Lactoflavin
The startup folder path can be found using Win+R and entering shell:startup. See hereAgape
I
5

You can make an application run as a service.

Check this article for details:

Interject answered 14/11, 2008 at 8:31 Comment(0)
A
3

You can use autoexnt for this. It was original designed for windows NT, but is still working in newer versions of windows.

You have to download the Windows 2003 Resource Kit to get it.

Alexandretta answered 14/11, 2008 at 8:34 Comment(2)
I was thinking windows resource kit would not work on Windows Xp. But it seems it installs on XP too!.. Thanks.Lactoflavin
WOW! your answer is best as i think, as other answers are related after windows log in.Interline
M
1

There's also hstart, a third party program that's worked well for my needs. It's maintained too. The last version was released on July 7, 2010.

Mean answered 10/7, 2010 at 7:19 Comment(1)
Thanks for suggesting this tool, just bought a license :)Rhatany

© 2022 - 2024 — McMap. All rights reserved.