gpt4 book ai didi

powershell - 运行powershell时 "- <"是什么意思?

转载 作者:行者123 更新时间:2023-12-04 01:52:35 33 4
gpt4 key购买 nike

运行脚本的推荐方式是

powershell.exe -NonInteractive -Command " & some.ps1 "

但是,例如 TeamCity PowerShell 运行程序使用:
powershell.exe -NonInteractive -Command - < some.ps1

我不知道“- <”是什么意思,也找不到有关该主题的任何信息。有什么帮助吗?

最佳答案

因为 powershell.exe是通过 Windows shell 调用的,这与您在普通命令提示符 ( cmd.exe ) 上的情况相同。在那种情况下 <将文件通过管道传输到上一个命令的标准输入 ( stdin )。 powershell.exe的帮助表示如果 -Command 的值就是 - ,命令文本是从标准输入中读取的。

这是 < 的更自我记录的演示在 cmd.exe :

processSomeFile.exe outputFileName.ext < intputFile.ext

关于powershell - 运行powershell时 "- <"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6816923/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com