We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
Hi ,
I need to open a command prompt from my script and need to enter some comands , and these commands i need to pass as a parameter
Something like : i need to open CMD prompt and enter ping 192.168.2.100, where my IP will be stored in variable
IP= "192.168.2.100"
i tried the following sys.oleObject("wscript.shell").Exec (cmd/c ping @IP) but not working
Try
var cmd = "ping 127.0.0.1";
var oShell = Sys.OleObject("WScript.Shell");
var ret = oShell.run("cmd /C " + cmd, 1, true);
Log.Message("ret = " + ret);
See Microsoft docs for more info: https://msdn.microsoft.com/en-us/library/d5fk67ky%28v=vs.84%29.aspx
Try
var cmd = "ping 127.0.0.1";
var oShell = Sys.OleObject("WScript.Shell");
var ret = oShell.run("cmd /C " + cmd, 1, true);
Log.Message("ret = " + ret);
See Microsoft docs for more info: https://msdn.microsoft.com/en-us/library/d5fk67ky%28v=vs.84%29.aspx
Thanks
I am able to pass argument