Zum Inhalt springen
Skillpedia
Allgemeines Programmieren48k · #6189

windows-shell-reliability

Was er macht

Dieses Tool hilft dir, Befehle unter Windows fehlerfrei auszuführen. Es zeigt dir, wie du Dateipfade mit Leerzeichen behandelst, die richtige Textcodierung verwendest und typische Stolperfallen beim Ausführen von Programmen vermeidest.

Wann du ihn nutzt

  • ✓Wenn du Programme für Windows erstellst oder reparierst.
  • ✓Wenn Befehle wegen Dateinamen mit Leerzeichen fehlschlagen.
  • ✓Wenn die Ausgabe eines Befehls seltsame Zeichen enthält.

Link zum Skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/windows-shell-reliability/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/windows-shell-reliability/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Wie starte ich ein Programm, das in einem Ordner mit einem Leerzeichen im Namen liegt?”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Das Tool zeigt dir, wie du Dateipfade mit Leerzeichen in Anführungszeichen setzt und bestimmte Windows-Befehle verwendest, um Codierungsfehler und Programmprobleme zu vermeiden.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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.
Häufige Fragen

Warum sind Anführungszeichen bei Pfaden wichtig?

Windows könnte ein Leerzeichen als Ende des einen Namens und Anfang des nächsten interpretieren. Das führt dann zu Fehlern.

Was ist Textcodierung?

Das ist die Art, wie der Computer Zeichen darstellt. Mit der falschen Codierung können Umlaute und andere Symbole falsch angezeigt werden.

Kann ich Befehle wie 'del' oder 'copy' verwenden?

Ja, aber PowerShell hat sicherere und klarere Cmdlets wie 'Remove-Item' und 'Copy-Item', die in Skripten besser geeignet sind.

Details

Originalbeschreibung des Autors

Reliable command execution on Windows: paths, encoding, and common binary pitfalls.

repo: sickn33/agentic-awesome-skills

Beliebtheit

GitHub-Sterne
48k
Platz im Ranking
#6189
Lizenz
MIT
Aktualisiert
15.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills