Powershell Parsing Help - How to output a list of folder names into a text file Powershell Parsing Help - How to output a list of folder names into a text file powershell powershell

Powershell Parsing Help - How to output a list of folder names into a text file


Try this one:

Get-ChildItem C:\Source\Path | ForEach-Object { $_.Name } > C:\Output\File.txt

Related resources:


You can get just the names with the -Name switch:

$accFolder = Read-Host "Enter the account folder container....: "Get-ChildItem -Name "D:\influxcyst\$accFolder" | Out-File $HOME\desktop\$accFolder.txt


$accFolder = Read-Host "Enter the account folder container....:" cmd /c dir /b /ad D:\influxcyst\$accFolder > $HOME\desktop\$accFolder.txt