向cmd命令插入一个变量 [英] insert a variable to cmd command

查看:412
本文介绍了向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)\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

the input is "LabelName" and it should insert instead of the "3.1.006"

't管理插入此变量,它保持插入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)\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  " & LabelName

这篇关于向cmd命令插入一个变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆