没有扩展名的 Powershell 中的文件输出 [英] File Output in Powershell without Extension

查看:54
本文介绍了没有扩展名的 Powershell 中的文件输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我目前所拥有的:

Get-ChildItem "C:\Folder" | Foreach-Object {$_.Name} > C:\Folder\File.txt

当您打开上面的输出文件 File.txt 时,您会看到:

When you open the output from above, File.txt, you see this:

file1.txt
file2.mpg
file3.avi
file4.txt

我如何获得输出以删除扩展名并仅显示此内容:

How do I get the output so it drops the extension and only shows this:

file1
file2
file3
file4

提前致谢!

编辑

在我下面的人的帮助下弄清楚了.我最终使用了:

Figured it out with the help of the fellows below me. I ended up using:

Get-ChildItem "C:\Folder" | Foreach-Object {$_.BaseName} > C:\Folder\File.txt

推荐答案

Get-ChildItem "C:\Folder" | Select BaseName > C:\Folder\File.txt

这篇关于没有扩展名的 Powershell 中的文件输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆