In the words of the famous Liz Lemon: What the what?!
I am getting reasonably frustrated by being unable to do what seems to be a simple thing, all I want is a script that goes through a directory and creates an output file which has the names of all files with a certain extension, one file per line, and no other information. How hard can that be?
Here's what I have:
This creates output that looks like this:
[CR][LF]
filename.dat
[CR][LF]
[CR][LF]
[CR][LF]
filename.dat
[CR][LF]
[CR][LF]
[CR][LF]
filename.dat
etc...
What the what?!?!!!?!
Where do all those new-lines come from?
format-list output isn't too much different.
I guess I am just approaching this the wrong way but googling around for it just results in information overload ( Los Links! )
So, is there a way to do this in PowerShell? Thanks in advance for any insight you may be able to provide.
I am getting reasonably frustrated by being unable to do what seems to be a simple thing, all I want is a script that goes through a directory and creates an output file which has the names of all files with a certain extension, one file per line, and no other information. How hard can that be?
Here's what I have:
Code:
$File = "E:\temp\file-list.txt"
get-childitem "E:\temp" -recurse -include *.dat |
ForEach-Object { $_ | format-table name -hideTableHeaders | Out-File $file -append }
This creates output that looks like this:
[CR][LF]
filename.dat
[CR][LF]
[CR][LF]
[CR][LF]
filename.dat
[CR][LF]
[CR][LF]
[CR][LF]
filename.dat
etc...
What the what?!?!!!?!
Where do all those new-lines come from?
format-list output isn't too much different.
I guess I am just approaching this the wrong way but googling around for it just results in information overload ( Los Links! )
So, is there a way to do this in PowerShell? Thanks in advance for any insight you may be able to provide.