Windows环境下当程序开机自启服务安装失败时,自己制作开机自动启动服务,以下我以安装Nexus服务为例:
1、首先建一个.bat文件。
2、文件内容为:
@echo off
nexus install && nexus start
1、首先建一个.bat文件。
2、文件内容为:
@echo off
nexus install && nexus start
taskkill /f /im cmd.exe
3、把该脚本放在开始菜单->启动中。
代码解释:
nexus install && nexus start :安装nexus服务并启动nexus服务。把这一行替换成自己要执行的命令,就变成自己想要的脚本文件了。
taskkill /f /im cmd.exe :强制关闭cmd.exe(dos窗口)。