equivalent of (dir/b > files.txt) in PowerShell

后端 未结 6 1177
借酒劲吻你
借酒劲吻你 2021-02-05 05:04
dir/b > files.txt

I guess it has to be done in PowerShell to preserve unicode signs.

6条回答
  •  南笙
    南笙 (楼主)
    2021-02-05 05:51

    Just found this great post, but needed it for sub directories as well:

    DIR /B /S >somefile.txt
    

    use:

    Get-ChildItem -Recurse | Select-Object -ExpandProperty Fullname | Out-File Somefile.txt
    

    or the short version:

    ls | % fullname > somefile.txt
    

提交回复
热议问题