Windows 启动时在后台运行批处理文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/289498/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Running Batch File in background when windows boots up
提问by Manoj
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.
每次 Windows 启动时如何运行批处理文件,我还需要在后台运行它(不显示该命令窗口)?我使用 Windows XP。我的实际要求是我想在 Windows 启动时使用命令行命令启动 Tracd 服务器。
回答by VonC
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
回答by Manoj
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.
- 你可以随时将 bat 文件添加到启动文件夹中,
- 或将其作为计划任务设置启动以在登录时运行。
回答by Klathzazt
You can make an application run as a service.
您可以将应用程序作为服务运行。
Check this articlefor details:
查看这篇文章了解详情:
回答by wimh
You can use autoexntfor this. It was original designed for windows NT, but is still working in newer versions of windows.
您可以为此使用autoexnt。它最初是为 Windows NT 设计的,但仍在较新版本的 Windows 中工作。
You have to download the Windows 2003 Resource Kitto get it.
您必须下载 Windows 2003 Resource Kit才能获得它。