windows-shell-reliability
Helps your agent execute commands on Windows reliably. It avoids common issues with paths and encoding.
What it does
This tool helps run commands on Windows without errors. It teaches how to handle file paths with spaces, use correct text encoding, and avoid common pitfalls when running programs.
When to use it
- ✓When creating or fixing programs that run on Windows.
- ✓When commands fail due to filenames with spaces.
- ✓If command output text appears with strange characters.
Example of what to ask your AI
“How do I run a program located in a folder with a space in its name?”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool teaches to put quotes around file paths with spaces and to use specific Windows commands to avoid encoding errors or program issues.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add sickn33/agentic-awesome-skills --skill windows-shell-reliabilityOr download just the file:
curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/windows-shell-reliability/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Windows Shell Reliability Patterns
Best practices for running commands on Windows via PowerShell and CMD.
When to Use
Use this skill when developing or debugging scripts and automation that run on Windows systems, especially when involving file paths, character encoding, or standard CLI tools.
1. Encoding & Redirection
CRITICAL: Redirection Differences Across PowerShell Versions
Older Windows PowerShell releases can rewrite native-command output in ways that break later processing. PowerShell 7.4+ preserves the byte stream when redirecting stdout, so only apply the UTF-8 conversion workaround when you are dealing with older shell behavior or a log file that is already unreadable.
| Problem | Symptom | Solution |
|---|---|---|
dotnet > log.txt |
view_file fails in older Windows PowerShell |
`Get-Content log.txt |
npm run > log.txt |
Need a UTF-8 text log with errors included | `npm run ... 2>&1 |
Rule: Prefer native redirection as-is on PowerShell 7.4+, and use explicit UTF-8 conversion only when older Windows PowerShell redirection produces an unreadable log.
2. Handling Paths & Spaces
CRITICAL: Quoting
Windows paths often contain spaces.
| ❌ Wrong | ✅ Correct |
|---|---|
dotnet build src/my project/file.fsproj |
dotnet build "src/my project/file.fsproj" |
& C:\Path With Spaces\bin.exe |
& "C:\Path With Spaces\bin.exe" |
Rule: Always quote absolute and relative paths that may contain spaces.
The Call Operator (&)
In PowerShell, if an executable path starts with a quote, you MUST use the & operator.
Pattern:
& "C:\Program Files\dotnet\dotnet.exe" build ...
3. Common Binary & Cmdlet Pitfalls
| Action | ❌ CMD Style | ✅ PowerShell Choice |
|---|---|---|
| Delete | del /f /q file |
Remove-Item -Force file |
| Copy | copy a b |
Copy-Item a b |
| Move | move a b |
Move-Item a b |
| Make Dir | mkdir folder |
New-Item -ItemType Directory -Path folder |
Tip: Using CLI aliases like ls, cat, and cp in PowerShell is usually fine, but using full cmdlets in scripts is more robust.
4. Dotnet CLI Reliability
Build Speed & Consistency
| Context | Command | Why |
|---|---|---|
| Fast Iteration | dotnet build --no-restore |
Skips redundant nuget restore. |
| Clean Build | dotnet build --no-incremental |
Ensures no stale artifacts. |
| Background | Start-Process dotnet -ArgumentList 'run' -RedirectStandardOutput output.txt -RedirectStandardError error.txt |
Launches the app without blocking the shell and keeps logs. |
5. Environment Variables
| Shell | Syntax |
|---|---|
| PowerShell | $env:VARIABLE_NAME |
| CMD | %VARIABLE_NAME% |
6. Long Paths
Windows has a 260-character path limit by default.
Fix: If you hit long path errors, use the extended path prefix:
\\?\C:\Very\Long\Path\...
7. Troubleshooting Shell Errors
| Error | Likely Cause | Fix |
|---|---|---|
The term 'xxx' is not recognized |
Path not in $env:PATH | Use absolute path or fix PATH. |
Access to the path is denied |
File in use or permissions | Stop process or run as Admin. |
Encoding mismatch |
Older shell redirection rewrote the output | Re-export the file as UTF-8 or capture with `2>&1 |
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
FAQ
Why are quotes important for paths?
Because Windows might interpret a space as the end of one name and the start of another, causing errors.
What is text encoding?
It's how the computer represents characters. Using the wrong encoding can make accents and other symbols appear incorrectly.
Can I use commands like 'del' or 'copy'?
Yes, but PowerShell has safer and clearer cmdlets like 'Remove-Item' and 'Copy-Item' that are preferable in scripts.
Details
Original description by the author
Reliable command execution on Windows: paths, encoding, and common binary pitfalls.
Popularity
- GitHub stars
- 48k
- Ranking position
- #4575
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
00-andruia-consultant
Helps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
sickn33/agentic-awesome-skills
007
Lets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
sickn33/agentic-awesome-skills
10-andruia-skill-smith
Helps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
sickn33/agentic-awesome-skills
20-andruia-niche-intelligence
Lets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
sickn33/agentic-awesome-skills
Similar skills
benchmark-optimization-loop
Has your agent improve something's speed in a measured way. It tests multiple versions and chooses the fastest one that still works correctly.
affaan-m/ECC
change-impact
Helps your agent analyze the impact of code changes before making them. It compares the planned vs. actual results afterward, covering paths, data, tests, and documentation. Useful for risky or system-wide changes.
affaan-m/ECC
click-path-audit
Lets your agent trace all user buttons and interactions to find bugs. It finds issues where functions seem to work alone but fail together. Useful when bugs persist even after debugging.
affaan-m/ECC