vbscript - why CMD window get the parameter name and not the value of parameter -


i need run following command on cmd window under c:\program files\connection

 connect  "user_vip" 

so write short vb script perform action

dim oshell set oshell = wscript.createobject ("wscript.shell") userc = """user_vip""" wscript.echo userc oshell.run "cmd /k cd c:\program files\connection & connect userc   " ,1 , true 

after run vb script see following cmd window

connect userc    

and not expected see:

 connect  "user_vip" 

why userc parameter in oshell.run not real value - "user_vip" ??

  • remark - wscript.echo userc print value - "user_vip" expected

vbscript not interpolate variable content string literals , path containing blanks/spaces in shell command needs quotes (" escaped "") change

oshell.run "cmd /k cd c:\program files\connection & connect userc   " ,1 , true 

to

oshell.run "cmd /k cd ""c:\program files\connection"" & connect " & userc, 1, true 

update wrt comment:

>> userc = "abc" >> wscript.echo "cmd /k cd ""c:\program files\connection"" & connect " & userc >> cmd /k cd "c:\program files\connection" & connect abc 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -