You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
1017 B
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Windows BAT 部署启动器设计
## 目标
让 Windows 用户无需在 CMD 中手动输入 PowerShell 命令,可通过双击 BAT 文件完成首次 SSH 配置、服务器初始化和日常发布。
## 设计
-`E:\workspace\dianshang\deploy\automation` 增加三个 ASCII 文件名的 BAT 文件,避免 CMD 编码导致中文文件名不可用。
- 每个 BAT 通过 `%~dp0` 定位自身目录,调用系统自带 `powershell.exe` 并使用 `-NoProfile -ExecutionPolicy Bypass -File` 执行对应 PS1。
- `01_setup_ssh.bat` 调用 `Initialize-SshKey.ps1``02_initialize_server.bat` 调用 `deploy.ps1 -InitializeOnly``03_deploy.bat` 调用 `deploy.ps1`
- BAT 将 PowerShell 退出码原样保留,成功或失败后 `pause`,使用户能看到提示与错误内容。
- BAT 不接受或保存服务器密码、SSH 私钥内容或数据库密码。
## 验证
- 使用 `cmd.exe /c` 验证三个 BAT 的语法与路径解析。
- 确认 BAT 仅调用预期 PS1且退出码会被返回。