@echo off rem =========================================================================== rem AgentSkills - skills linker for Windows (cmd / .bat version) rem --------------------------------------------------------------------------- rem This file is deliberately PURE ASCII, UTF-8/ANSI agnostic, CRLF endings. rem rem Why: cmd.exe decodes a batch file with the *current console code page*. rem A 936 (Simplified-Chinese / Explorer double click) console and a 65001 rem (PowerShell 7) console decode the same non-ASCII bytes differently, and rem switching the code page inside a batch file (chcp) can desynchronise cmd's rem parser so that it executes comment text. A pure ASCII file has no such rem ambiguity: every byte means the same thing under every code page, and the rem output renders identically everywhere. Keep it ASCII when editing. rem =========================================================================== setlocal EnableExtensions DisableDelayedExpansion rem =========================================================================== rem AgentSkills skills linker (Windows) - the counterpart of skills_linker.sh rem rem What it does: scans \\ two levels below this rem script and links every skill directory into the global skills directory rem (default %USERPROFILE%\.agents\skills) so every project can use them. rem How it links: a directory junction first (no admin rights, no developer rem mode needed), falling back to a directory symlink (mklink /D). Use rem /c (copy mode) when links are not usable, e.g. on a network path. rem Safety: it only adds or removes the links themselves inside the target rem directory - it never enters or deletes the content behind a link, and it rem never overwrites a real directory that happens to share a skill name. rem =========================================================================== set "EXITCODE=0" set "ROOT=%~dp0" if "%ROOT:~-1%"=="\" set "ROOT=%ROOT:~0,-1%" if "%ROOT:~-1%"==":" set "ROOT=%ROOT%\" set "TARGET=" set "MODE=link" set "DRYRUN=0" set "PAUSE_AT_END=0" set "TMPLIST=" set /a N_LINKED=0 >nul set /a N_REPLACED=0 >nul set /a N_REMOVED=0 >nul set /a N_COPIED=0 >nul set /a N_SKIPPED=0 >nul set /a N_WARN=0 >nul set /a N_FAIL=0 >nul rem A double click starts us as: cmd /c ""