NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how to execute a system command with call executable in teststand 4.2.1?

Hi All,

      how to execute a system command with "call executable" step in teststand 4.2.1?

      example as i want to quit a application.using "taskkill /f /im xxx.exe".And execute other system command(DOS).

 

BR

Johnny

     

0 Kudos
Message 1 of 8
(12,101 Views)

Callcmdexe.PNG

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 8
(12,098 Views)

Hi Norbert,

    Thanks for your reply.

     I have tried it as you input.I input "taskkill /f /im xxx.exe" in the Argument Expression.And windows can pop-up a DOS window.But it seems can not execute the command.The DOS windows hold on,no response.Only display:"C:\WINDOWS\system32>"

 

BR

Johnny

0 Kudos
Message 3 of 8
(12,095 Views)

You need either /K or /C in front of the taskkill. Compare to the echo-parameter....

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 8
(12,090 Views)

Hello,

    It is done.Thanks a lot.

 

BR

Johnny

0 Kudos
Message 5 of 8
(12,073 Views)

Hi, 

 

I want to run netstat -an | find "8080" command from command prompt using call executable in test stand. after that i would like take the std output to local variable. 

 

0 Kudos
Message 6 of 8
(10,635 Views)

You have to enter the following string (including all quotation marks!) in the Argument Expression:

"/k netstat -an|find \"8080\""

 

The return value can be stored by configuring a target variable on the Standard Output/Error tab >> Output Destination. Select "Store in Variable/Property" and pick a string variable (e.g. Step.StdOutput.Text).

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 8
(10,627 Views)

For commands that have their own corresponding exe, you don't need to use cmd.exe at all. Just call them directly from the callexecuteable step. For example:

 

forum.png

 

cmd.exe is only needed if you need to issue a command that is builtin to the cmd.exe and not an exe of its own.

 

Hope this helps,

-Doug

0 Kudos
Message 8 of 8
(10,614 Views)