在 cmd 命令中插入一个变量 [英] insert a variable to cmd command
本文介绍了在 cmd 命令中插入一个变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从用户那里获取输入(字符串)并将其插入到 cmd 命令中,
I need to get a input from the user (string) and insert it in a cmd command,
Set oShell = WScript.CreateObject("WScript.Shell")
Set LabelName = WScript.CreateObject("WScript.Shell")
LabelName = InputBox("Please Enter Label to check-out:", _
"Create File")
oShell.run "cmd /K ""c:Program Files (x86)BorlandStarTeam Cross-Platform Client 2008 R2stcmd.exe"" co -p bla:bla123@123.com:7777/bla/ -is -eol on -o -rp D:ST_test -cfgl 3.1.006"
输入是LabelName",它应该插入而不是3.1.006"
the input is "LabelName" and it should insert instead of the "3.1.006"
我无法插入这个变量,它一直在插入 LabelName 而不是值
i can't manage to insert this variable, it keeps inserting LabelName instead of the value
推荐答案
LabelName 不需要是 shell 对象,如 它只是一个字符串.然后将字符串连接到运行命令上,您就完成了.
LabelName doesn't need to be a shell object, as it's just a string. Then concatenate the string onto the run command and you are done.
Set oShell = WScript.CreateObject("WScript.Shell")
Dim LabelName
LabelName = InputBox("Please Enter Label to check-out:", _
"Create File")
oShell.run "cmd /K ""c:Program Files (x86)BorlandStarTeam Cross-Platform Client 2008 R2stcmd.exe"" co -p bla:bla123@123.com:7777/bla/ -is -eol on -o -rp D:ST_test -cfgl " & LabelName
这篇关于在 cmd 命令中插入一个变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文