简体   繁体   English

Windows启动时在后台运行批处理文件

[英]Running Batch File in background when windows boots up

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)? 每次Windows启动时如何运行批处理文件,还需要在后台运行(不显示该命令窗口)? I use Windows Xp. 我使用Windows Xp。 My actuall requirement is I want to start the Tracd server using the command line commands whenever Windows boots up. 我的实际要求是,每当Windows启动时,我都想使用命令行命令启动Tracd服务器。

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... 在invis.vbs中...

CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

Two other startup posibilties: 另外两个启动的可能性:

  • you could always add the bat file to the startup folder, 您可以随时将bat文件添加到启动文件夹中,
  • or start it as a Scheduled task setting to run on logon. 或将其作为计划任务设置启动以在登录时运行。

You can make an application run as a service. 您可以使应用程序作为服务运行。

Check this article for details: 查看本文以了解详细信息:

You can use autoexnt for this. 您可以为此使用autoexnt It was original designed for windows NT, but is still working in newer versions of windows. 它最初是为Windows NT设计的,但仍可以在Windows的较新版本中使用。

You have to download the Windows 2003 Resource Kit to get it. 您必须下载Windows 2003 Resource Kit才能获得它。

There's also hstart , a third party program that's worked well for my needs. 还有一个hstart ,它可以很好地满足我的需求。 It's maintained too. 它也得到维护。 The last version was released on July 7, 2010. 最新版本于2010年7月7日发布。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM