windows-7 - 命令行语法可防止在 PowerShell 输出文件中换行?

标签 windows-7 powershell command-line redirect word-wrap

以下命令将输出包装到调用脚本的窗口的宽度。也就是说,输出文件是“字”包装的。如何在不修改脚本的情况下防止输出文件中的这种换行?

PS C:\Users\User1> & '\\fileServer\c$\PowerShell Scripts\herScript.ps1' > output.txt

最佳答案

试试这个(我无法测试)

& '\\fileServer\c$\PowerShell Scripts\herScript.ps1' | out-string -width 4096 | out-file c:\output.txt

关于windows-7 - 命令行语法可防止在 PowerShell 输出文件中换行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8973577/

相关文章:

postgresql - 打开端口,以便 Windows 7 上的 pgAdmin 可以连接到 VirtualBox 上的 Debian 上的 PostgreSQL

powershell - 如何在Powershell中导出具有arraylist的对象

windows - 哪些操作需要在 Windows 中提升 UAC?

windows-7 - 设置环境变量需要在 64 位上重启

windows - 批量 IF 语句总是返回 false?

powershell - 从任务计划程序运行的 PowerShell 脚本中的 Msgbox 不起作用

xml - 在PowerShell上将节点从一种XML导入到另一种XML

linux - 如何通过命令行自动响应密码提示?

mysql - MAMP MySQL 命令行 "show database;"不会显示所有数据库

bash - 如何对名称中包含空格的文件执行 shell "for"命令?