在PowerShell中相当于(dir / b> files.txt) [英] equivalent of (dir/b > files.txt) in PowerShell
本文介绍了在PowerShell中相当于(dir / b> files.txt)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
dir/b > files.txt
我想必须在PowerShell中完成以保留unicode符号。
I guess it has to be done in PowerShell to preserve unicode signs.
推荐答案
Get-ChildItem | Select-Object -ExpandProperty Name > files.txt
或更短:
ls | % Name > files.txt
但是,您可以轻松地在 cmd中执行相同的操作
:
However, you can easily do the same in cmd
:
cmd /u /c "dir /b > files.txt"
/ u
开关显示 cmd
以Unicode格式编写重定向到文件中的内容。
The /u
switch tells cmd
to write things redirected into files as Unicode.
这篇关于在PowerShell中相当于(dir / b> files.txt)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文