Skip to content

Commit

Permalink
use nssm for windows (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonStudio authored May 15, 2023
1 parent f78faee commit f883fa2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 68 deletions.
43 changes: 10 additions & 33 deletions docs/guide/install/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,39 +133,16 @@ Then, execute `launchctl load ~/Library/LaunchAgents/ci.nn.alist.plist` to load

@tab Windows

method 1

Use **`.VBS`** script to start and stop, create two scripts respectively start.vbs and stop.vbs

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

::: info Two startup scripts

**start.vbs**

```vbscript
Dim ws
Set ws = Wscript.CreateObject("Wscript.Shell")
ws.run "alist.exe server",vbhide
Wscript.quit
```

**stop.vbs**

```vbscript
Dim ws
Set ws = Wscript.CreateObject("Wscript.Shell")
ws.run "taskkill /f /im alist.exe",0
Wscript.quit
```

1. If the script will not be created, you can download it yourself: [**Script Download**](https://www.aliyundrive.com/s/DHPMhRtKUzY/folder/63e0961eae317bd4d4d945cda69dbb00f9837fb7)

2. If the script will not be used, you can watch the video: [**reference video**](https://www.bilibili.com/video/BV1DG411s7j5?t=266.2)

:::

How to realize Windows startup automatically, you can refer to the script mentioned above to use the video (second).
1. Download the newest `nssm` from https://nssm.cc/download.
2. Unzip the archive and go to the diretory of `nssm.exe`.
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".
4. Type `.\nssm.exe install alist`.
5. Select the path of `alist.exe` for "Path", e.g. `D:\alist\alist.exe`; type `server` for "Argument".
6. You can custom "Display Name", "Description" and "Startup Type" in "Details" tab.
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.
8. Click on "Install Service".

You can now start the service from services.msc or task manager.

::::

Expand Down
44 changes: 9 additions & 35 deletions docs/zh/guide/install/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,41 +134,15 @@ WantedBy=multi-user.target

@tab Windows

方法1

**`.VBS`** 脚本启动和停止,分别创建两个脚本 分别是 启动.vbs 和 停止.vbs

直接在和Alist启动程序同级文件夹里面双击启动即可,不用担心没有反应 直接去 浏览器访问即可


::: info 两个启动脚本

**启动.vbs**

```vbscript
Dim ws
Set ws = Wscript.CreateObject("Wscript.Shell")
ws.run "alist.exe server",vbhide
Wscript.quit
```

**停止.vbs**

```vbscript
Dim ws
Set ws = Wscript.CreateObject("Wscript.Shell")
ws.run "taskkill /f /im alist.exe",0
Wscript.quit
```

1. 脚本不会创建的可以自行下载:[**脚本下载**](https://www.aliyundrive.com/s/DHPMhRtKUzY/folder/63e0961eae317bd4d4d945cda69dbb00f9837fb7)

2. 脚本不会使用的可以看看视频:[**参考视频**](https://www.bilibili.com/video/BV1DG411s7j5?t=266.2)

:::


如何实现Windows开机自启,可以参考上面提到的脚本使用视频(第二个)。
1.https://nssm.cc/download 下载最新版本的 `nssm`
2. 在解压后的文件夹内按住 Shift 并右击空白处,选择“在此处打开 Powershell 窗口”;
3. 在弹出的窗口中输入 `.\nssm.exe install alist`
4. Path 选择 alist.exe 的路径,如 `D:\alist\alist.exe`,Arguments 填 `server`
5. Details 选项卡中可以自定义标题和描述,可以选择服务的自启动模式(自动|延迟启动|手动|禁用);
6. 在 I/O 选项卡为 Output (stdout) 和 Output (stderr) 各自指定一个日志文件的路径,如 `D:\alist\stdout.log`,文件本身(`stdout.log`)可以不存在,但是指定的目录(`D:\alist`)必须存在;
7. 点击“Install Service”即可。

此后可以直接在服务中启动 `alist`

::::

Expand Down

0 comments on commit f883fa2

Please sign in to comment.