Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将 Format-List 命令的输出写入事件日志,所以我需要它作为字符串。
有没有一种通用的方法来做到这一点,它不依赖于知道正在格式化的内容?
使用Out-Stringcmdlet:
Out-String
... | Format-List | Out-String