NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Error running Bat/vbs files in Teststand

Hi

 

I have made a Telnet vbs script that I want to be executed in TestStand.

For that purpose I use the Call_Executeable function.

But when I am running the vbs in TestStand I am getting this error: Telnet is not recognized as an internal or external command.

But when I am running the vbs from a normal CMD or Win7 it´s executing without any problem.

I am using Win7 and I have enabled the Telnet.

 

My script looks like this:

 

Set cloner = CreateObject("WScript.Shell")
cloner.run"cmd"
WScript.Sleep 500


cloner.SendKeys"telnet 192.168.103.10"
cloner.SendKeys("{Enter}")
WScript.Sleep 500

 

cloner.SendKeys"quit"
cloner.SendKeys("{Enter}")

 

WScript.Sleep 2000
cloner.SendKeys"exit"
cloner.SendKeys("{Enter}")

 

I can´t seem to see what the difference is between running the file from TestStand which starts the CMD and then executing vbs script or executing the vbs script in a CMD that I have manually opened?

 

Kind regards Jacob

0 Kudos
Message 1 of 3
(3,760 Views)

I just did some further investigations:

 

When i make a Call_Executable and try to run Telnet.exe directly i can not find the Telent.exe using the Call_Executable file browser (Attacment: TestStandTelnetbrower).

But i can find it when i do a search in windows (Attacment: WindowsTelnetbrowser)I tried copying the Telnet.exe file to C: and then i was able to find and run the Telnet.exe in Teststand.

 

Any idea?

Download All
0 Kudos
Message 2 of 3
(3,756 Views)

@Jacob(JCA) wrote:

Hi

 

I have made a Telnet vbs script that I want to be executed in TestStand.

For that purpose I use the Call_Executeable function.

But when I am running the vbs in TestStand I am getting this error: Telnet is not recognized as an internal or external command.

But when I am running the vbs from a normal CMD or Win7 it´s executing without any problem.

I am using Win7 and I have enabled the Telnet.

 

My script looks like this:

 

Set cloner = CreateObject("WScript.Shell")
cloner.run"cmd"
WScript.Sleep 500


cloner.SendKeys"telnet 192.168.103.10"
cloner.SendKeys("{Enter}")
WScript.Sleep 500

 

cloner.SendKeys"quit"
cloner.SendKeys("{Enter}")

 

WScript.Sleep 2000
cloner.SendKeys"exit"
cloner.SendKeys("{Enter}")

 

I can´t seem to see what the difference is between running the file from TestStand which starts the CMD and then executing vbs script or executing the vbs script in a CMD that I have manually opened?

 

Kind regards Jacob


The difference is probably your current working directory. Windows looks in the current working directory when you specify a program to run without a full path. When you ran the script manually you were probably running it from the directory that contains telenet.exe. You can set the current working directory settings for the call executeable step to get a similar behavior. Or you can specify a full path to telnet in your script.

 

-Doug

0 Kudos
Message 3 of 3
(3,734 Views)