dsh-no-cmd-launcher
DSH background launcher: double-click icon to run dsh web without any cmd window, plus desktop start/stop shortcuts (npm/CLI installs, no DSH Desktop dependency)
- Stars
- 1
- Language
- PowerShell
- Created
- Aug 22, 2026
- Updated
- Aug 22, 2026
Introduction
DSH 后台启动工具(免 cmd,适配纯 CLI / npm 安装)
给习惯在 cmd / 终端里敲 dsh web 的人用:双击桌面图标即可后台静默启动 DSH,
不出现任何 cmd 窗口,关掉终端也不影响运行,启动完成后自动打开浏览器界面。
本工具不依赖 DSH Desktop 桌面应用,适用于通过 npm 等纯 CLI 方式安装 dsh 的用户。
前置条件
- Windows + Node.js(
dsh命令行工具运行所需) - 已安装 dsh 且
dsh命令在 PATH 中(例如npm install -g @deepseek-ai/dsh, 以你实际的安装方式为准)。验证:在 cmd 里执行dsh --version能输出版本号。
文件说明
| 文件 | 作用 |
|---|---|
start-dsh.ps1 | 核心启动器(端口可改,见下文) |
stop-dsh.ps1 | 停止器:只结束本工具拉起的后台服务(node.exe / DSH Desktop.exe 进程树) |
start-dsh.vbs | 无窗口外壳(快捷方式指向它,零闪烁) |
stop-dsh.vbs | 无窗口外壳(停止用) |
install-shortcuts.ps1 | 一键安装桌面快捷方式(图标自动取 DSH Desktop.exe → node.exe → 系统默认) |
README.md | 本文档 |
安装(一次性)
在 PowerShell 里执行(或右键 install-shortcuts.ps1 → “使用 PowerShell 运行”):
powershell -ExecutionPolicy Bypass -File "本目录\install-shortcuts.ps1"
可选参数:
-AutoStart:额外注册开机自启(登录后静默后台启动 DSH)-Uninstall:移除桌面快捷方式与自启项
装完桌面上会出现两个图标:DSH 后台启动、DSH 后台停止。
使用
- 点 DSH 后台启动:
- DSH 已在运行(3080 或 6338 端口有服务)→ 直接打开浏览器,不会开第二个实例;
- 未运行 → 无窗口后台启动
dsh web --port 3080,就绪后自动打开浏览器。
- 点 DSH 后台停止:结束后台服务(按 PID 文件精确结束进程树,安全)。
配置(可选)
编辑 start-dsh.ps1 顶部几行:
$Port = 3080:服务端口,与 cmd 里dsh web的默认端口一致。$AltPort = 6338:备用检测端口——该端口上已有 DSH(如桌面版)在跑时,直接打开它。- 日志:
%USERPROFILE%\.dsh\dsh-web-background.log - 进程记录:
%USERPROFILE%\.dsh\dsh-web-background.pid
原理
start-dsh.vbs(wscript,本身无窗口)以隐藏方式调用 PowerShell
(-WindowStyle Hidden),PowerShell 先通用解析 PATH 里的 dsh 命令
(npm shim 是 dsh.cmd),再以 cmd /c call "dsh.cmd" web --port 3080 >> 日志 2>&1
的 CreateNoWindow(无窗口)+ 日志重定向 方式启动 dsh web,进程与调用者完全脱离——
所以没有 cmd 窗口,关掉任何终端也不影响它。就绪后脚本把监听端口的进程 PID 写入
dsh-web-background.pid,stop-dsh.ps1 据此 taskkill /T 结束进程树。
常见问题
- 点了没反应? 看日志
%USERPROFILE%\.dsh\dsh-web-background.log。 - 提示"未找到 dsh 命令"? 确认已
npm install -g @deepseek-ai/dsh(或你的安装方式) 且 bin 目录在 PATH;重开一个终端验证dsh --version。 - 启动超时? 多半是 3080 被其它程序占用,改
$Port后重试。 - 本机同时装了 DSH Desktop? 桌面版端口是动态的,启动器会自动检测其主进程
正在监听的端口并直接打开它(不会重复启动);两者共用同一套浏览器界面。
检测失败时则退回静态端口检查(
$AltPort)。