powershell - 为什么我在文本文件中没有输出文件或没有内容?

标签 powershell

这个问题在这里已经有了答案:





Question about using PowerShell Select-String, exiftool(-k)

(2 个回答)


2年前关闭。




用于运行批处理文件的 Power shell 脚本:

start-Process C:\Test.bat |
Out-File C:\test.txt

当我检查 text.txt文件是空的?

最佳答案

不要使用 Start-Process如果您只需要以或多或少的默认方式运行程序。

C:\Test.bat | Out-file C:\Test.txt

应该可以正常工作,尽管您很可能缺乏对 C:\ 的写入权限所以这可能不是最有用的使用途径。

关于powershell - 为什么我在文本文件中没有输出文件或没有内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60579768/

相关文章:

json - 为 Azure 文件共享存储帐户部署模板时遇到的问题

Azure Powershell - 将多个服务终结点应用到子网

powershell - Hudson不会使用Powershell插件运行任何Powershell脚本

regex - 将目录更改为与 powershell 中的正则表达式匹配的文件夹

c# - 在 C# 代码中运行 PSCmdLets (Citrix XenDesktop)

java - 启动 powershell 脚本的 HTML 网页

powershell - 如何在Powershell中将用户添加到本地管理员组?

powershell - 在Powershell中将电子邮件收件人字符串拆分为数组

powershell - 列出 AD 用户的组成员身份

powershell - 获取变量 Powershell 中资源组的位置值