Append or put variable within string in vbscript? -


i wanting include variable domainuser within quoted command sent commandline not having luck. trying accomplish create log file titled domain name keep getting errors or getting txt file no title.

dim domainuser domainuser = example123  objinparam.properties_.item("commandline") = "cmd /c echo test >> c:\userlogs\"""domainuser""".txt" 

so line 4 read (or whatever domain user put in on line 2)...

objinparam.properties_.item("commandline") = "cmd /c echo test >> c:\userlogs\example123.txt" 

you need concatenation splice variable's content string , double double quotes put double quotes it:

>> dim domainuser >> domainuser = "example123" >> dim cmd >> cmd = "cmd /c echo test >> ""c:\userlogs\" & domainuser &  ".txt""" >> wscript.echo cmd >> cmd /c echo test >> "c:\userlogs\example123.txt" 

Comments