' QQ 助手 —— 强制停止服务（兜底用；正常关窗口会自动停）
' 源码模板（UTF-8）-> node desktop\encode-assets.js -> desktop\停止服务.vbs (UTF-16LE+BOM)
Option Explicit
Dim fso, sh, root, nodeExe, cand, p, f

Set fso = CreateObject("Scripting.FileSystemObject")
Set sh  = CreateObject("WScript.Shell")
root = fso.GetParentFolderName(fso.GetParentFolderName(WScript.ScriptFullName))
nodeExe = ""

cand = fso.BuildPath(root, "runtime\node.exe")
If fso.FileExists(cand) Then nodeExe = cand

If nodeExe = "" Then
  p = sh.ExpandEnvironmentStrings("%PATH%")
  For Each f In Split(p, ";")
    If Len(f) > 0 Then
      cand = fso.BuildPath(f, "node.exe")
      If fso.FileExists(cand) Then
        nodeExe = cand
        Exit For
      End If
    End If
  Next
End If

If nodeExe = "" Then
  cand = sh.ExpandEnvironmentStrings("%LOCALAPPDATA%\Programs\DeepSeek Harness\resources\runtime\primary-runtime\dependencies\node\bin\node.exe")
  If fso.FileExists(cand) Then nodeExe = cand
End If

If nodeExe = "" Then
  MsgBox "没找到 node.exe。", 16, "QQ 助手"
  WScript.Quit 1
End If

sh.CurrentDirectory = root
sh.Run """" & nodeExe & """ """ & fso.BuildPath(root, "desktop\stop.js") & """", 0, True
