Windows 此时命令行 %argument 是意外的(只有一个百分比!)
Windows command line %argument was unexpected at this time (with single percentage!)
我正在尝试 运行 在 命令提示符 中执行以下命令,参数只有一个百分比,因为命令提示符说明应该如此:
for /F %remote in ('git branch -a') do (git branch --track %remote) && git fetch --all && git pull --all
但我仍然收到以下错误:
%remote was unexpected at this time.
这个 "argument was unexpected at this time" 有很多问题。我搜索了又搜索,但几乎所有解决方案都涉及使用 % 或 %% 之间的相同混淆。双百分比只能在批处理文件中使用。但我使用的是正确的符号。为什么不起作用?
会不会是括号的原因?我不知道 this issue mentioned on Microsoft's website 是否相关。
阅读文档
C:\>for /?
Runs a specified command for each file in a set of files.
FOR %variable IN (set) DO command [command-parameters]
%variable Specifies a single letter replaceable parameter.
请注意文档的 第 3 行 如何说 "single letter"
(完整的帮助文本有 153 行。我建议全部阅读)
我正在尝试 运行 在 命令提示符 中执行以下命令,参数只有一个百分比,因为命令提示符说明应该如此:
for /F %remote in ('git branch -a') do (git branch --track %remote) && git fetch --all && git pull --all
但我仍然收到以下错误:
%remote was unexpected at this time.
这个 "argument was unexpected at this time" 有很多问题。我搜索了又搜索,但几乎所有解决方案都涉及使用 % 或 %% 之间的相同混淆。双百分比只能在批处理文件中使用。但我使用的是正确的符号。为什么不起作用?
会不会是括号的原因?我不知道 this issue mentioned on Microsoft's website 是否相关。
阅读文档
C:\>for /?
Runs a specified command for each file in a set of files.
FOR %variable IN (set) DO command [command-parameters]
%variable Specifies a single letter replaceable parameter.
请注意文档的 第 3 行 如何说 "single letter"
(完整的帮助文本有 153 行。我建议全部阅读)