查到下面的方法,觉得不太方便
引用自 jimmyge (Do Re Mi)
想让一个程序在启动系统的时候自动运行,你有什么好办法?添加到启动组?那如果别人删除掉就不管用了。如果你使用了Windows NT/2000/XP,就可以试试把这个程序添加为一个服务,这样只有拥有权限的人才可以更改服务,只要你设置好权限,就不用担心会被别人删除了。
要把应用程序添加为服务,你需要两个小软件:Instsrv.exe和Srvany.exe。Instsrv.exe可以给系统安装和删除服务,Srvany.exe可以让程序以服务的方式运行。这两个软件都包含在Windows NT Resource Kit里,如果你没有,也可以点击这里下载。
把这两个程序保存在一个方便的位置,例如C盘根目录下。我们举例来说明,把OE作为一个服务添加进Windows XP Professional操作系统中,并把这个服务命名为“Mail”。在运行中输入“CMD”,回车,打开命令行窗口,在提示符后面直接输入:“c:\instsrv.exe Mail c:\srvany.exe”然后回车,其中的“c:\instsrv.exe”和“c:\srvany.exe”表示这两个程序保存的位置,而Mail则是你想添加的服务名称。
Run SRVINSTW.EXE
1. Put both files into the system32 system directory.
2. run SRVINSTW.EXE
3. Select Install as a service, Local Machine
4. Give your service any name you desire
5. When prompted for the path to the service, give the path to SERVANY.EXE in your system32 directory
6. Select Service is it’s own process
7. Set the login credentials. System account appears to work
Edit your registry
1. Run regedit.exe
2. Go to HKEY_LOCAL_MACHINE\SYSTEM\Current Control Set\Services\ (the name you picked in step 4 above)
3. Add a key = “Parameters”
4. Add a string value = “Application”. Set this to the command to run your wiki. e.g. “c:\ruby\bin\ruby.exe c:\instiki-0.9.1\instiki.rb -p 2500” (or use rubyw.exe)
5. Add a string value = “AppDirectory”. Set this to the path to ruby.exe. e.g. “c:\ruby\bin\”
Restart your machine
1. check to see if it worked.
2. if it didn’t work, go to Control Panel\Administrative tools\services. Here you can find your service and change the settings.