File Output in Powershell without Extension

Posted by CaptHowdy on Stack Overflow See other posts from Stack Overflow or by CaptHowdy
Published on 2012-11-13T22:33:34Z Indexed on 2012/11/13 23:00 UTC
Read the original article Hit count: 242

Filed under:
|

Here is what I have so far:

Get-ChildItem "C:\Folder" | Foreach-Object {$_.Name} > C:\Folder\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

Thanks in advance!

EDIT

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

© Stack Overflow or respective owner

Related posts about powershell

Related posts about powershell-v2.0