gpt4 book ai didi

powershell - 如何从 Powershell 中获取最新的 Mercurial 标签

转载 作者:行者123 更新时间:2023-12-04 19:19:10 25 4
gpt4 key购买 nike

如果我从 DOS 提示符运行以下命令:

hg parent --template {latesttag}

然后我得到按预期返回的最新标签值。但是,如果我从 powershell 控制台中运行相同的命令,则会出现以下错误:

hg parent :选项 -i 无法识别

我需要命令在 powershell 中运行,以便我可以将其结果作为要使用的变量。知道我需要做什么才能运行命令吗?

最佳答案

您应该只需要将参数括在 --template 中。在引号中,以便 Powershell 知道它是一个字符串:

hg parents --template '{latesttag}'

然而,有时,使用 Powershell 解析事物的方式,您必须加倍确保双引号仍然存在(例如传递包含空格但应该是 1 个参数而不是多个参数的参数,例如路径或更长的模板):
hg parents --template '"{latesttag}"'

关于powershell - 如何从 Powershell 中获取最新的 Mercurial 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6180786/

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