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

后端 未结 6 1168
借酒劲吻你
借酒劲吻你 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:38

    Since powershell deals with objects, you need to specify how you want to process each object in the pipe.

    This command will get print only the name of each object:

    dir | ForEach-Object { $_.name }
    

提交回复
热议问题