window 开机自启程序的多种方式

2020-10-22  本文已影响0人  sorry510

第一种:将执行程序放置在 启动 目录下即可,目录所在位置如下

%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup  

或者 在运行里面输入:shell:startup 可以自动跳转到对应目录下

第二种:注册表添加启动项

找到注册表的如下位置

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
image.png
新建一条字符串类型的数据,名字改为你要启动的程序比如 test.exe image.png
右键点击修改,将数值名称改为程序所在的路径即可
image.png

第三种:任务计划程序

右键我的电脑,点击管理

image.png

选中任务计划程序,在右边点击创建基本任务

image.png
填写好名称
image.png
触发器为 计算机登录时
image.png
image.png
选中要启动的程序即可
image.png

第四种:注册为自动的服务(此种方式是带守护进程功能的)

下载 winsw,选择 WinSW.NET4.exe,将它改名为 winsw.exe
https://github.com/winsw/winsw/releases

创建 xml 配置文件,名字叫 winsw.xml

<service>
  <!-- ID of the service. It should be unique across the Windows system-->
  <id>minio</id>
  <!-- Display name of the service -->
  <name>minio</name>
  <!-- Service description -->
  <description>minio start</description>
  
  <!-- Path to the executable, which should be started -->
  <executable>E:\env\minio.exe</executable>
  <startmode>Automatic</startmode>
  <arguments>server E:\minio</arguments>
</service>

将这2个文件放到同一目录, 然后执行 winsw install 即可 ,如果需要卸载服务执行 winsw uninstall
服务效果如图

image.png
上一篇 下一篇

猜你喜欢

热点阅读