英文:
Windows: Issue coming when running multiple commands in 1 line, and not when running then one by one
问题
以下是翻译好的部分:
当在Windows命令行上运行以下命令时,会出现问题:
set P4USER=ARPIT & set P4PORT=opl:p4dia:1934 & set P4CLIENT=opl_reg_591 & p4 client -o
错误:
Perforce客户端错误:
连接到服务器失败;请检查$P4PORT。
未找到指定的类。
但是当在cmd上逐个运行这些命令时,没有问题:
set P4USER=ARPIT
set P4PORT=opl:p4dia:1934
set P4CLIENT=opl_reg_591
p4 client -o
为什么会这样?
我想将这4个小命令在一行中运行,因为我必须在脚本中的反引号中使用它们。如何解决这个问题?
英文:
When running following command on windows command line, issue is coming:
set P4USER=ARPIT & set P4PORT=opl:p4dia:1934 & set P4CLIENT=opl_reg_591 & p4 client -o
Error:
Perforce client error:
Connect to server failed; check $P4PORT.
The specified class was not found.
But when running these command, one by one, on cmd, no issue is coming:
set P4USER=ARPIT
set P4PORT=opl:p4dia:1934
set P4CLIENT=opl_reg_591
p4 client -o
Why so?
I want to run these 4 mini commands in 1 line, as I have to use them in a backtick in a script. How can this issue be resolved?
答案1
得分: 0
"Magoo 的回答 (为每个被设置的变量设定“P4USER=ARPIT”
) 是正确的。
此外,在这种情况下可以使用以下内容:
p4 -u ARPIT -c opl_reg_591 -p opl:p4dia:1934 client -o"
英文:
@Magoo answer (set "P4USER=ARPIT" for each of the variables being set. Your current syntax includes the space before the & into the value assigned. Quoting as shown makes the assignment required
) is right.
Also, the following can be used in this context:
p4 -u ARPIT -c opl_reg_591 -p opl:p4dia:1934 client -o
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论