[英]How to retrieve the full file extension from filenames with 2+ dots in CMD?
[英]how to retreive a list of filenames from a directory without the file extension
我有一个我经常使用的 powershell 命令来获取特定目录中的文件列表
dir -name > 文件名.txt
输出
文件名.pdf 文件名2.pdf
但是,这会创建一个带有文件扩展名的列表。 有没有一种简单的方法可以运行单行命令,该命令返回不包括文件扩展名的文件名。
我希望结果如下
文件名文件名2
只需使用:
(Get-ChildItem | Select -Expand BaseName) >filenames.txt
Basename
属性获取不带扩展名的文件名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.