List files with path and file size only in Command Line

Get-ChildItem -Recurse | select FullName,Length | Format-Table -HideTableHeaders | Out-File filelist.txt

forfiles /s /c "cmd /c echo @path @fsize" >filelist.txt

OP's chosen answer using PowerShell (and their comment that they used Get-ChildItem -Recurse | select Length,LastWriteTime,FullName | Format-Table -Wrap -AutoSize | Out-File filelist.txt) was almost what I wanted for processing in Excel. Thanks for that part.

Unfortunately, (as they mentioned) the output had wrapped lines for long file paths, which isn't quite what I wanted.

The following command will produce a CSV formatted file (no wrapped lines):

Get-ChildItem -Recurse | select Length,LastWriteTime,FullName | Export-Csv -path filelist.csv -NoTypeInformation

Kudos to https://stackoverflow.com/a/23434457/7270462 for the tip about Export-Csv


PowerShell:

gci -rec -file|%{"$($_.Fullname) $($_.Length)"} >filelist.txt

earlier PowerShell versions:

gci -rec|?{!$_.PSIsContainer}|%{"$($_.Fullname) $($_.Length)"} >filelist.txt

Batch file:

(@For /F "Delims=" %%A in ('dir /B/S/A-D') Do @Echo %%~fA %%~zA) >filelist.txt

Cmdline

(@For /F "Delims=" %A in ('dir /B/S/A-D') Do @Echo %~fA %~zA) >filelist.txt