[Windows] PowerShell tool guidance: prefer -LiteralPath for file paths (brackets are wildcards with -Path)
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 1/5
- Geschätzter Aufwand
- Unter einer Stunde
- Anfängerfreundlichkeit
- 74/100
- Issue-Typ
- Feature
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- powershell
- Bereich
- developer-experience
Rechercherichtung
Finde die integrierte PowerShell-Toolanleitung und lies die vorhandenen Windows-Tipps zu && im Vergleich zu ; und zu Here-Strings. Ergänze eine knappe Anleitung, -LiteralPath für konkrete Quellpfade zu verwenden, sofern unterstützt, und -Path für gezielte Platzhaltersuche vorzubehalten. Fertig ist die Änderung, wenn die Anleitung den Unterschied und die aufgeführten Cmdlets für Quellpfade behandelt, ohne den Eindruck zu erwecken, dass dies auch für Zielparameter gilt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the feature or problem you'd like to solve
On Windows, the agent often passes file names containing [ ] to cmdlets via -Path (the default), so PowerShell treats them as wildcards: commands fail, Test-Path returns a false negative, and Remove-Item can delete a different file.
Proposed solution
Add a line to the built-in PowerShell tool guidance, alongside the existing Windows tips (&& vs ;, no heredoc), for example:
For concrete filesystem paths, prefer
-LiteralPathwhere supported; quoting-Pathdoes not disable wildcard expansion ([ ] * ?). Use-Pathonly when wildcard matching is intentional. (This applies to source paths such asGet-Content,Set-Content,Test-Path,Remove-Item,Copy-Item,Move-Item,Rename-Item,Get-ChildItem; not to destination parameters.)
Benefit: fewer failed tool calls and retries, and it reduces the risk of acting on the wrong file (data loss with Remove-Item / Move-Item / Set-Content).
Example prompts or workflows
- "Rename the scans in this folder to yyyy-MM-dd format": files like
scan[2].jpgfail with-Path; the agent then retries with-LiteralPath. - "Delete del[2].jpg":
Remove-Item -Path 'del[2].jpg'deletesdel2.jpgif it exists, and the requested file stays. - "Edit notes [draft].md":
Set-Content -Pathfails with "An object at the specified path ... does not exist".
Additional context
Repro (pwsh 7.6.9, Copilot CLI 1.0.105, Windows):
Set-Content -LiteralPath 'a[1].txt' x
Test-Path -Path 'a[1].txt' # False (file exists)
Get-Content -Path 'a[1].txt' # error: An object at the specified path a[1].txt does not exist...
Set-Content a1.txt y
Remove-Item -Path 'a[1].txt' # deletes a1.txt, keeps a[1].txt
Docs: about_Wildcards and Supporting Wildcard Characters in Cmdlet Parameters / -LiteralPath.
Filed as a feature request rather than a bug: PowerShell behaves as designed; the ask is guidance for the model. No existing issue found for "LiteralPath".
- Vorherrschende Sprache
- Python
- Sterne
- 11.5k
- Forks
- 2k
- Ø Merge
- 6 Std. 34 Min.
- Gemergte PRs (30 T.)
- 3
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus github/copilot-cli
-
area:plugins
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
github/copilot-cli#5567 ·
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 78/100
github/copilot-cli#5489 ·
-
Built-in functions.view returns no content for large files despite documenting automatic truncationOffenarea:tools
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
github/copilot-cli#5476 ·
-
triage
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 74/100
github/copilot-cli#5377 ·
-
area:configuration area:models
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
github/copilot-cli#5287 ·
Alle Issues in github/copilot-cli
Ähnliche Issues
-
fidelity
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
backlog
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
sagemathinc/sagebrush#3434 ·
Maintainer antworten meist innerhalb von 1 Tag
-
marketing
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 1 Tag
-
documentation good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
wuisabel-gif/MemWhale#576 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Status: Triage Suggestion
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
GTNewHorizons/GT-New-Horizons-Modpack#27957 ·
Maintainer antworten meist innerhalb von 1 Tag