Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Batch File in background when windows boots up

Tags:

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.

like image 981
Manoj Avatar asked Nov 14 '08 08:11

Manoj


People also ask

How do I get a batch file to run automatically when I start Windows?

Run a batch file at loading of Windows 8 and 10Press Start, type Run, and press Enter . In the Run window, type shell:startup to open the Startup folder. Once the Startup folder is opened, click the Home tab at the top of the folder. Then, select Paste to paste the shortcut file into the Startup folder.

How do I run a batch file when Windows is shutting down?

If you need to allow them to restart, you can add a batch file to the All Users\Desktop folder to call the command shutdown.exe \r \t 10 which will force a restart of the computer after 10 seconds.


1 Answers

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 
like image 55
VonC Avatar answered Oct 07 '22 18:10

VonC