名前に角括弧「[」「]」を含むファイルをGet-ChildItemやCopy-Itemで取り扱う方法[Windows PowerShell]
PowerShellで、名前に角括弧「[」「]」を含むファイルをGet-ChildItemやCopy-Itemで指定しても、正しく認識することができません。
![](https://assets.st-note.com/img/1648393440771-8awZLhv2uK.png?width=800)
![](https://assets.st-note.com/img/1648394329664-9L2Lr7EVMu.png?width=800)
そんな時は、Get-ChildItemやCopy-Itemのパラメータに「LiteralPath」を指定することで実現することが可能です。
Get-ChildItem -LiteralPath ファイル名
Copy-Item -LiteralPath コピー元ファイル名 コピー先ファイル名
![](https://assets.st-note.com/img/1648395361245-O3imo94Hh8.png?width=800)
以上、名前に角括弧「[」「]」を含むファイルをGet-ChildItemやCopy-Itemで取り扱う方法でした。
この記事が気に入ったらサポートをしてみませんか?