Install — paste one line into Windows CMD or PowerShell:
powershell -ExecutionPolicy Bypass -c "irm https://raw.githubusercontent.com/FanFantom9452/BatRunner/master/install.ps1 | iex"Prints a green ✅ Install Completed when done, then reload VS Code. It
downloads the latest release and sideloads into official VS Code, no
Marketplace account needed. Re-run the same line anytime to update. (Needs
VS Code with the code CLI on PATH — added by default by the Windows installer.)
Run .bat / .cmd straight from the editor title bar: run it in place, keep
the terminal open after it finishes, and export the captured output (with a
header + exit code) to a UTF-8 log file next to the script.
Other ways to install (no remote script / PowerShell / macOS / Linux / manual)
Windows CMD (downloads + installs directly, no remote script):
curl -fL -o "%TEMP%\batrunner.vsix" https://github.com/FanFantom9452/BatRunner/releases/latest/download/batrunner.vsix && code --install-extension "%TEMP%\batrunner.vsix"Windows PowerShell:
iwr https://github.com/FanFantom9452/BatRunner/releases/latest/download/batrunner.vsix -OutFile "$env:TEMP\batrunner.vsix"; code --install-extension "$env:TEMP\batrunner.vsix"macOS / Linux:
curl -fL -o /tmp/batrunner.vsix https://github.com/FanFantom9452/BatRunner/releases/latest/download/batrunner.vsix && code --install-extension /tmp/batrunner.vsixManual: download batrunner.vsix from the repo's Releases page, then in
VS Code → Extensions → ... → "Install from VSIX...".
The -f flag makes curl fail loudly on a missing download, so a 404 never
gets installed as a broken file.
- ▶ Run (editor title bar): runs the active script in an integrated terminal at the script's own folder. The terminal stays open after the run.
- 💾 Export Last Output (editor title bar): saves the captured output to
batRunnerLogs/<name>.<timestamp>.txtnext to the script, as UTF-8. - Run in External CMD (Command Palette): opens an external
cmd /kwindow. Output cannot be captured or exported in this mode. - Clear Terminal (terminal right-click menu /
Ctrl+Alt+L): clears the screen and scrollback (so scrolling up shows nothing).
| Setting | Default | Description |
|---|---|---|
batRunner.autoSave |
false |
Auto-export output after each run. |
batRunner.encoding |
cp950 |
Codepage to decode output (use utf8 if your scripts emit UTF-8). |
batRunner.logFolderName |
batRunnerLogs |
Log subfolder name. |
batRunner.utf8Bom |
true |
Add a UTF-8 BOM to exported files. |
batRunner.terminalMode |
integrated |
Default run location (integrated or external). |
Windows cmd emits text in the console's OEM codepage, which on Traditional
Chinese Windows is cp950 (Big5). BatRunner reads the script's RAW output
bytes and decodes them with batRunner.encoding (default cp950), so Chinese
output is captured and exported correctly without mojibake.
- If your scripts run on a cp950 console (the zh-TW default), keep
cp950. - If your scripts emit UTF-8 (e.g. they run
chcp 65001first), setbatRunner.encodingtoutf8.
test/fixtures/sample.bat is ASCII-only on purpose, so it displays correctly
regardless of console codepage.
npm installnpm run compile— bundle with esbuildnpm run test:unit— run unit tests- Press
F5to launch the Extension Development Host.
npm run compile, then pressF5to open the Extension Development Host.- Open
test/fixtures/sample.batin the host window. - Confirm a ▶ and 💾 icon appear at the editor's top-right.
- Click ▶. Confirm a terminal "BatRunner: sample.bat" opens, echoes the
command, prints the lines and
Done., then[exit code: 0], and stays open. - Click 💾. Confirm an info message shows a path under
test/fixtures/batRunnerLogs/sample.<timestamp>.txt; click "Open File" and confirm the header (Script/Command/Started/Exit) plus the output are correct. - Run ▶ again, then right-click the terminal → "BatRunner: Clear Terminal"
(or
Ctrl+Alt+L). Scroll up: nothing should remain (scrollback cleared). - Command Palette → "BatRunner: Run in External CMD": an external CMD window opens, runs the script, stays open, and a warning notes output can't be exported in that mode.