[英]PowerShell Output Filenames of a Specific Extension to a Text File
Currently, I'm using the following command to output filenames to a text file:目前,我正在使用以下命令将 output 文件名转换为文本文件:
( Get-ChildItem -File ).BaseName | Out-File "Track List.txt" -Encoding utf8
How can I limit the filenames to a specific extension, eg, .mp3?如何将文件名限制为特定扩展名,例如 .mp3?
The -Filter paramater accepts wildecards -? -Filter 参数接受通配符 -? for any single character, and * for zero or more matches
用于任何单个字符,* 用于零个或多个匹配项
( Get-ChildItem -File -Filter *.mp3).BaseName | Out-File "Track List.txt" -Encoding utf8
See the Powershell documentaiton on -Filter and wildcards for more information [wildcards]:有关更多信息 [通配符],请参阅有关 -Filter 和通配符的Powershell文档:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.