| || |
Problem when calling a vbscript using SystemUtil.Run
I have a vbscript file, and I want to display some information when the script is executed, so I add some WScript.StdOut.WriteLine statements in it. The script can be run smoothly under dos command.
But when I call it in QTP using SystemUtil.Run, there is an error at the WScript.StdOut.WriteLine statment, saying that the handle is invalid.
When this statment is removed from the script, the script can be run.
How to resolve this problem? Or is there any alternative besides using WScript.StdOut.WriteLine?
Re: Problem when calling a vbscript using SystemUtil.Run
Actually, I am wondering whether the param passed to SystemUtil.Run cannot contain spaces.
I am using the script to telnet to a remote machine and do a command. I will use the param to pass the specified command. for example:
Cscript //e:vbscript telnet.vbs "net user newuser /add"
the string in the quotation mark is handled as one parameter to the script.
But when i use it in the QTP as:
SystemUtil.Run "telnet.vbs","net user newuser /add","D:\Script"
It take the string as four parameters, so actually the param1 passed to the script is just a "net" command. That's not what i want.
How to include several words as one paramter passed to the script?