Forum Discussion

cshukusky's avatar
cshukusky
Contributor
10 years ago

cm does not recognize command when launched through TestComplete script

 

When I manually launch cmd and type telnet and press enter, I get the message "Welcome to Microsoft Telnet Client", as I would expect.

 

I wrote a vbscript routine in TestComplete to do the same, but when I run it I get "'telnet' is not recognized as an internal or external command, operable program or batch file." in the cmd window.

 

Here is a sample:

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

sub test
dim wscriptObj

set wscriptObj = createobject("WScript.Shell")

Call wscriptObj.run("cmd.exe")
Call delay(1000)
Call wscriptObj.SendKeys("telnet{Enter}")
end sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

 

I also tried using 'set wscriptObj = sys.oleobject("WScript.Shell")', but still got the same result.

 

I even tried making cmd a testedapp, ran the testedapp and used the keys method instead of sendkeys to type, but still got the same result.

 

So I went into notepad with the original code from above and created a vbs file containing the below:

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

dim wscriptObj
set wscriptObj = createobject("WScript.Shell")
Call wscriptObj.run("cmd.exe")
call wscript.sleep(1000)
Call wscriptObj.SendKeys("telnet{Enter}")

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

 

And when I run that, separate from testcomplete, that works successfully.

 

As far as I can tell, based on the caption of all the cmd windows, I am always launching the system32 cmd (manually, through vbs, and through testcomplete).

 

Is there something I am missing?

1 Reply

  • Nevermind.

     

    Figured it out.

     

    Apparently, even when you specify C:\windows\system32\cmd.exe, you still get the SysWow64 version even though the wndcaption indicates system32.

     

    You have to launch C:\windows\sysnative\cmd.exe to actually get the system32 version.