PicoBot/package/start-gateway.vbs

33 lines
1.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

' PicoBot Gateway 后台启动脚本
' 双击运行即可,完全无窗口
Set WshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
scriptDir = fso.GetParentFolderName(WScript.ScriptFullName)
' 把当前目录切到脚本所在目录,避免相对路径问题
WshShell.CurrentDirectory = scriptDir
' 依次查找 exe同目录 → release → debug
exePath = scriptDir & "\picobot.exe"
If Not fso.FileExists(exePath) Then
exePath = scriptDir & "\..\..\target\release\picobot.exe"
If Not fso.FileExists(exePath) Then
exePath = scriptDir & "\..\..\target\debug\picobot.exe"
End If
End If
' 转成绝对路径,确保 Run 能正确找到
exePath = fso.GetAbsolutePathName(exePath)
If Not fso.FileExists(exePath) Then
MsgBox "picobot.exe not found." & vbCrLf & "Build first: cargo build --release", 48, "PicoBot"
WScript.Quit 1
End If
' Launch in background (0=hidden window, False=don't wait)
WshShell.Run """" & exePath & """ gateway", 0, False
MsgBox "PicoBot Gateway started in background." & vbCrLf & "Open http://127.0.0.1:19876", 64, "PicoBot"