【发布时间】:2014-03-18 11:24:34
【问题描述】:
我需要从用户那里得到一个输入(字符串)并将其插入到一个 cmd 命令中,
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)\Borland\StarTeam Cross-Platform Client 2008 R2\stcmd.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”
我无法插入这个变量,它一直在插入 LabelName 而不是值
【问题讨论】:
-
那你的问题是什么?
-
这是一个常见的错误,在tag wiki 中有介绍。 VBScript 不会在字符串中展开变量。相反,您需要将变量与字符串的两半连接起来。