windows-bat-authoring

Write and debug Windows batch files avoiding cmd.exe parsing pitfalls.

Updated Aug 21, 2026
One-click install
npx skills add https://github.com/TylerSimons1127/vibe --skill windows-bat-authoring-tylersimons1127
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: windows-bat-authoring
Source: https://github.com/TylerSimons1127/vibe/tree/main/skills/devops/windows-bat-authoring
Command: npx skills add https://github.com/TylerSimons1127/vibe --skill windows-bat-authoring-tylersimons1127

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Windows batch files fail in confusing ways: echo. triggers . was unexpected at this time., parenthesized if blocks mis-execute, backslash PYTHONPATH breaks Python imports, and %ERRORLEVEL% gets clobbered. This Skill provides a checklist of known cmd.exe traps and their fixes so batch scripts work the first time. ## Core Features & Use Cases - Pitfall Catalog: Documents seven real cmd.exe failure modes (echo. / echo: blank lines, parenthesized if blocks, backslash PYTHONPATH, missing call, parse-time variable expansion, unset %TEMP%/%USERPROFILE%) with concrete fixes. - Working Launcher Template: A verified verify-then-launch .bat template for running a Python venv app, using goto labels, forward-slash PYTHONPATH, and call for ERRORLEVEL propagation. - Verification Guidance: Explains why bat output through git-bash wrappers is unreliable and how to use the app's own log file as ground truth. - Use Case: You need a .bat that verifies a Python environment and launches an app on Windows; apply the template and grep for echo. before shipping to avoid the classic parse errors. ## Quick Start Ask the agent to write a Windows batch file that verifies a Python venv and launches your app, applying the cmd.exe pitfall checklist from this Skill.

Frequently Asked Questions about windows-bat-authoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix '. was unexpected at this time.' in a batch file?▼

This error is caused by `echo.` (echo dot) used for blank lines, especially inside parenthesized if blocks. Replace every `echo.` and `echo:` with `echo/`, which prints a blank line reliably across cmd builds.

How to write a batch file that launches a Python venv app?▼

Set PYTHONPATH with forward slashes, use `call` to invoke the venv python.exe so ERRORLEVEL propagates, capture it with `set RC=%ERRORLEVEL%`, and branch with `goto` labels instead of parenthesized if blocks.

Why does Python fail with ModuleNotFoundError when run from a bat file?▼

Backslash-separated PYTHONPATH entries can fail to resolve on Windows even when the paths are valid. Set PYTHONPATH using forward slashes, for example C:/Users/me/proj;C:/Users/me/proj/src, which Python on Windows accepts.

Why does my if block in a batch file get skipped or mis-execute?▼

Parenthesized if blocks are parsed as a unit, so %VAR% expands at parse time and echo statements with special characters can break the block. Rewrite the logic with goto labels, which sidesteps both the expansion and parsing traps.

Can I trust batch file output captured through git-bash?▼

No, console output from a bat run via a git-bash `cmd.exe /c` wrapper is often stale or truncated. Have the launched app write its own log file and inspect that log as the ground truth for whether the script actually ran.

Why is %TEMP% or %USERPROFILE% empty when my batch file runs?▼

When a bat is launched by a non-interactive harness such as git-bash invoking cmd.exe /c, environment variables like %TEMP% and %USERPROFILE% can be unset. Hardcode absolute paths or verify variables are set before using them for sentinel files.