Skip to content

Commit f883fa2

Browse files
use nssm for windows (#219)
1 parent f78faee commit f883fa2

File tree

2 files changed

+19
-68
lines changed

2 files changed

+19
-68
lines changed

docs/guide/install/manual.md

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -133,39 +133,16 @@ Then, execute `launchctl load ~/Library/LaunchAgents/ci.nn.alist.plist` to load
133133

134134
@tab Windows
135135

136-
method 1
137-
138-
Use **`.VBS`** script to start and stop, create two scripts respectively start.vbs and stop.vbs
139-
140-
Just double-click to start it in the folder at the same level as the Alist startup program, don't worry about no response, just go to the browser to access it
141-
142-
::: info Two startup scripts
143-
144-
**start.vbs**
145-
146-
```vbscript
147-
Dim ws
148-
Set ws = Wscript.CreateObject("Wscript.Shell")
149-
ws.run "alist.exe server",vbhide
150-
Wscript.quit
151-
```
152-
153-
**stop.vbs**
154-
155-
```vbscript
156-
Dim ws
157-
Set ws = Wscript.CreateObject("Wscript.Shell")
158-
ws.run "taskkill /f /im alist.exe",0
159-
Wscript.quit
160-
```
161-
162-
1. If the script will not be created, you can download it yourself: [**Script Download**](https://www.aliyundrive.com/s/DHPMhRtKUzY/folder/63e0961eae317bd4d4d945cda69dbb00f9837fb7)
163-
164-
2. If the script will not be used, you can watch the video: [**reference video**](https://www.bilibili.com/video/BV1DG411s7j5?t=266.2)
165-
166-
:::
167-
168-
How to realize Windows startup automatically, you can refer to the script mentioned above to use the video (second).
136+
1. Download the newest `nssm` from https://nssm.cc/download.
137+
2. Unzip the archive and go to the diretory of `nssm.exe`.
138+
3. Hold Shift and right click on the blank space, then release and press S or select "powershell here", you should now see a blue window named "Windows PowerShell".
139+
4. Type `.\nssm.exe install alist`.
140+
5. Select the path of `alist.exe` for "Path", e.g. `D:\alist\alist.exe`; type `server` for "Argument".
141+
6. You can custom "Display Name", "Description" and "Startup Type" in "Details" tab.
142+
7. Go to "I/O" tab and select a file for both "Output (stdout)" and "Output (stderr)", e.g. `D:\alist\stdout.log`. The file itself (`stdout.log`) may not exist, but the folder (`D:\alist`) must exist.
143+
8. Click on "Install Service".
144+
145+
You can now start the service from services.msc or task manager.
169146

170147
::::
171148

docs/zh/guide/install/manual.md

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -134,41 +134,15 @@ WantedBy=multi-user.target
134134

135135
@tab Windows
136136

137-
方法1
138-
139-
**`.VBS`** 脚本启动和停止,分别创建两个脚本 分别是 启动.vbs 和 停止.vbs
140-
141-
直接在和Alist启动程序同级文件夹里面双击启动即可,不用担心没有反应 直接去 浏览器访问即可
142-
143-
144-
::: info 两个启动脚本
145-
146-
**启动.vbs**
147-
148-
```vbscript
149-
Dim ws
150-
Set ws = Wscript.CreateObject("Wscript.Shell")
151-
ws.run "alist.exe server",vbhide
152-
Wscript.quit
153-
```
154-
155-
**停止.vbs**
156-
157-
```vbscript
158-
Dim ws
159-
Set ws = Wscript.CreateObject("Wscript.Shell")
160-
ws.run "taskkill /f /im alist.exe",0
161-
Wscript.quit
162-
```
163-
164-
1. 脚本不会创建的可以自行下载:[**脚本下载**](https://www.aliyundrive.com/s/DHPMhRtKUzY/folder/63e0961eae317bd4d4d945cda69dbb00f9837fb7)
165-
166-
2. 脚本不会使用的可以看看视频:[**参考视频**](https://www.bilibili.com/video/BV1DG411s7j5?t=266.2)
167-
168-
:::
169-
170-
171-
如何实现Windows开机自启,可以参考上面提到的脚本使用视频(第二个)。
137+
1.https://nssm.cc/download 下载最新版本的 `nssm`
138+
2. 在解压后的文件夹内按住 Shift 并右击空白处,选择“在此处打开 Powershell 窗口”;
139+
3. 在弹出的窗口中输入 `.\nssm.exe install alist`
140+
4. Path 选择 alist.exe 的路径,如 `D:\alist\alist.exe`,Arguments 填 `server`
141+
5. Details 选项卡中可以自定义标题和描述,可以选择服务的自启动模式(自动|延迟启动|手动|禁用);
142+
6. 在 I/O 选项卡为 Output (stdout) 和 Output (stderr) 各自指定一个日志文件的路径,如 `D:\alist\stdout.log`,文件本身(`stdout.log`)可以不存在,但是指定的目录(`D:\alist`)必须存在;
143+
7. 点击“Install Service”即可。
144+
145+
此后可以直接在服务中启动 `alist`
172146

173147
::::
174148

0 commit comments

Comments
 (0)