跳到正文
dsh-market 浏览插件 GitHub EN

nirvanaslash/dsh-bat2exe

在 DSH 内把 Windows .bat/.cmd 启动器编译成真正的 .exe:用内置位图字体生成图标,生成调用同目录批处理的 C# 薄壳,经 csc.exe(或 dotnet build)编译,并可选写入开始菜单/桌面快捷方式。

Star 数 ★ 0 分类 开发与运行时 收录于 2026-09-15 npm dsh-bat2exe

安装

在 DeepSeek Harness 里通过 dsh-market 安装

dsh plugin --profile web add dshmarket

或使用命令行

dsh plugin --profile web add dsh-bat2exe

装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络。请先审阅源码,并尽量锁定 commit(github:owner/repo#sha)。

README

该插件的 README 只有英文版本。

Turn a Windows .bat / .cmd launcher into a real .exe — from inside DeepSeek Harness.

The EXE is a thin shell: it locates the batch file next to itself and hands the whole job to cmd.exe. The launcher logic stays editable text, no tool path is baked into the binary, and upgrading whatever the batch file calls needs no recompilation.

Install

dsh plugin --profile web add dsh-bat2exe

Restart DSH, then ask the agent to build a launcher — or call the tool directly.

Tools

bat2exe_build

Parameter Meaning
bat required — path to the .bat/.cmd file (absolute, or relative to the working directory)
name output executable name; defaults to the batch name with .exe
iconText up to four characters drawn on a generated icon
iconTextColour icon text colour as #rrggbb
icon use an existing .ico instead of rendering one
startMenuShortcut also write a Start Menu shortcut
desktopShortcut also write a Desktop shortcut

The build runs four steps, all local and offline:

  1. Icon — renders a rounded-square plate with a diagonal gradient and the given text, using a built-in 5×7 bitmap font, then packs it as a 256×256 ICO. No image library, no external tool.
  2. C# shell — emits a wrapper whose only job is to run the batch file from its own directory, forwarding all arguments and preserving the exit code.
  3. Compile — csc.exe from the .NET Framework (falling back to dotnet build when only the .NET SDK is present), with the icon embedded as a resource.
  4. Shortcuts — optional .lnk files, written through WScript.Shell.

bat2exe_probe

Reports the local toolchain — C# compiler path, .NET SDK presence, PowerShell, and the resolved defaults — so a failure can be diagnosed before a build is attempted.

Settings

bat2exe registers a settings namespace, so defaults are editable in Settings → Plugins rather than by hand-editing a profile patch:

Key Default Meaning
iconText BAT text drawn on a generated icon
iconFrom / iconTo #12204a / #4a6cf7 gradient start / end
workDir .bat2exe where *.cs, *.ico and other by-products go
startMenuShortcut false default for the Start Menu shortcut
desktopShortcut false default for the Desktop shortcut

Per-call tool arguments always win over these defaults.

Requirements

  • Windows. The pipeline compiles a Windows PE and writes .lnk files.
  • A C# compiler: .NET Framework 4.x (csc.exe, present on stock Windows) or the .NET SDK.
  • PowerShell for shortcut creation only (pwsh preferred, Windows PowerShell accepted).

bat2exe_probe reports exactly which of these were found.

What gets written

Everything lives next to the batch file, so a launcher folder is self-contained:

DSH-Web.bat            <- your launcher (unchanged)
DSH-Web.exe            <- the compiled shell
.bat2exe/
  DSH-Web.ico          <- generated (or your supplied) icon
  DSH-Web.cs           <- the emitted C# source, kept for inspection

License

MIT

内容来自项目 README(GitHub)↗

评论

评论存放在 GitHub Discussions。用 GitHub 账号登录后可发表评论或点表情。