| Windows Batch Snippets           
 Screenshot Install 
Dev install: open this folder in VS Code, press F5to launch an Extension Development Host, then open a.batfile and try a prefix.VSIX: install vsce(npm i -g @vscode/vsce), runvsce package, then in VS Code useExtensions: Install from VSIX.... Marketplace Publishing 
Create or verify a publisher named smeyiloon the Visual Studio Marketplace (manage publishers at https://marketplace.visualstudio.com/manage).Login with vsce:vsce login smeyilo(follow the instructions to create a PAT with Marketplace scope if prompted).Ensure package.jsonhas"publisher": "smeyilo", anicon, sensiblecategoriesandkeywords(already configured).Publish:
First time: vsce publish 0.2.0Next releases: vsce publish minor(orpatch/major)Alternatively, create a .vsixlocally withvsce packageand upload in the Marketplace UI. Automated Releases (GitHub Actions) 
Pushing a tag like v0.2.0triggers CI to package the VSIX and upload it to the GitHub Release.Workflow file: .github/workflows/release-vsix.yml. Automated Marketplace Publish 
Workflow: .github/workflows/publish-marketplace.ymlpublishes to the Visual Studio Marketplace on tag push.One-time setup required:
Create/verify Publisher smeyiloat https://marketplace.visualstudio.com/manageGenerate a VS Marketplace Personal Access Token (PAT) with publish permissions (see vscedocs)Add repo secret VSCE_PAT(GitHub → Repo → Settings → Secrets and variables → Actions)Optional: to publish to Open VSX, add repo secret OVSX_TOKEN.Release flow (local):
git pull --rebasenpm version patch -m "chore: release v%s"git push origin main --follow-tagsCI builds the VSIX, creates/updates the GitHub Release, and publishes to Marketplace. Use Snippets 
Open a .bator.cmdfile.Start typing a prefix (e.g., batskel,ifexist,gitac,ghpr) or pressCtrl+Spaceto trigger suggestions.Confirm a snippet, then press Tabto move between placeholders. Included Snippets 
batskel— boilerplate with@echo offandsetlocal.bat:usage— usage guard for required arguments.scriptdir— setSCRIPT_DIRto%~dp0andpushdinto it.ifexist— file/dir existence check with else.forfiles— iterate matching files in current folder.forr— recurse directories and iterate matches.forf— read a file line-by-line preserving spaces.forl— numeric loop (for /L).sub— subroutine pattern withcall :labelandgoto :eof.choice— continue/cancel prompt usingCHOICE.berr— run command and checkerrorlevel.delayed—EnableDelayedExpansionexample.args— simple argument parsing withSHIFT.ps— call PowerShell inline. More Snippets 
input— prompt for user input viaset /p.sleep— delay usingtimeout /t N /nobreak.robomirror— robustrobocopy /MIRwith logging and exit codes.robocopyx—robocopywith excludes (/XDdirs,/XFfiles).curlget/dlcert— download viacurlorcertutil.7zzip— compress a folder tozipwith7z.exe.regset/regget— write or read registry values.elevate— check admin and self‑elevate using PowerShell.netuse— map a network drive.logf— append to a log with timestamp subroutine.stamp— ISO-like timestamp variable for filenames.start— start a process or open a URL.kill— kill process by image name (taskkill).pathbin— prepend script‑relativebintoPATH.findstr— recursive text search with line numbers.forfcsv— parse CSV columns withfor /F. GitHub CLI (gh.exe) Snippets 
ghlogin— authenticate to GitHub.ghstatus— show auth status.ghcreate— create repo from current folder, setorigin, push.ghclone— clone repo viagh repo clone.ghfork— fork repo and also clone + set remote.ghissue/ghissues— create or list issues.ghpr/ghprco/ghprm— create, checkout, or merge PR.ghrel/ghrelupload— create release or upload asset.ghgist— create public gist from file.ghwflist/ghwfrun— list or trigger workflows.ghruns/ghrunwatch— list runs or watch a run.ghsecret— prompt and set repo secret.ghlabel/ghlabels— create or list labels.ghapi/ghapipost— REST API call templates (GET/POST).ghcscreate/ghcslist— create or list Codespaces.ghcsssh/ghcsstop/ghcsdelete/ghcscode— SSH, stop, delete, or open Codespace in VS Code. Git Snippets 
gitclone— clone a repo to a folder.gitinit— init repo, first commit, set default branch.gitst— concise status.gitac— add and commit.gitpullr— pull with rebase and autostash.gitpushu— push and set upstream.gitnb— create and switch to a new branch.gitswitch— switch to branch.gitbd/gitbdr— delete local or remote branch.gitstash— stash save (incl. untracked) and pop.gittag— create annotated tag and push.gitrshard— fetch and hard reset to remote branch.gitclean— clean untracked files/dirs (dangerous).gitlg— pretty one-line graph log.gitamend— amend last commit (no message change).gitfixup— fixup commit + autosquash rebase.gitcherry— cherry-pick a commit.gitroot— setGIT_ROOTandpushdthere.gitwtadd— add a linked worktree for a branch.gitconf— set global user/email andautocrlf. Develop / Run 
Open this folder in VS Code and press F5to launch an Extension Development Host.In the dev host, open a .batfile and try the prefixes above. Package (optional) 
Install vsceonce:npm i -g @vscode/vsce.From this folder, run: vsce packageto create a.vsixfile.In VS Code: Command Palette → Extensions: Install from VSIX.... Notes 
The language id for Windows Batch is batand covers both.batand.cmd.Inside batch files, loop variables use %%(e.g.,%%A), not%A.Some snippets call external tools (git,gh,7z,curl). Ensure they’re installed and onPATH.For ghsnippets, authenticate first: runghloginorgh auth login. |  |