From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

have to confiugre my called exe in TestStand each time I load teststand

I have to re-cofigure my "call exe" each time I load testStand or else the exe will not function properly.  The exe is a script that programs an IC through a JTAG programmer.  It basically loads the boot code then the firmware.  The exe is loading from teststand OK, but when it runs it states it cannot find the boot code file to load it.  If I go into testStand and configure the exe then everything runs OK.  
 
Thanks
 
 
0 Kudos
Message 1 of 6
(3,065 Views)

Are you using a file name or a full absolute path to specify your .exe?

If you are using a simple file name, what might be happening is that the act of browsing to your exe sets the current working directory, enabling your step to run.

To make it always work, use an absolute path or add the directory that contains your .exe to your TestStand search paths.

0 Kudos
Message 2 of 6
(3,060 Views)

Oops, misread the post. The exe is always found, but a file the exe needs is not.

It is still the same issue. Your exe probably relies on finding its file in the current working directory, which you are setting when you configure the step.

If the file the exe needs is a command line parameter, then maybe you can put an absolute path on the command line. Otherwise you could call the Window API with a DLL adapter step to set the current working directory before calling your executable.

0 Kudos
Message 3 of 6
(3,059 Views)

To set the current working directory with the DLL adapter, call:

BOOL SetCurrentDirectory(
  LPCTSTR lpPathName
);

in Kernel32.lib.

0 Kudos
Message 4 of 6
(3,059 Views)

I am pretty new to TestStand and Labview and have never used DLL adapters before or actually know where to find it.  How do I get this implemented?  The exe that is called is out of my control to modify. 

 

Thanks


ljark

0 Kudos
Message 5 of 6
(3,047 Views)
- Set the adapter selection drop list in the toolbar to C/C++ DLL
- Insert an Action step right before your Call Executable step
- Right click on the step and select Specify Module
- Enter kernel32.dll for the Module Pathname
- Enter SetCurrentDirectoryA for the FunctionName (yes, the A at the end is needed. The function comes in ANSI and Unicode variants)
-Click on Return Value in the Parameter list to select it. Now, in the Parameter Details list, change the Category from void to Boolean
- Click the New button to add another parameter. Change the Category to String. Leave the type as C String (const)
- Click in the value expression field for your new parameter. Enter a string constant with the absolute path of the folder that contains the file the executable needs to load.  Example:  "C:\\temp"   .  Note that backslashes need to be doubled inside string constants because backslash is the escape character.
 
 
 
 
 
 
 
Message 6 of 6
(3,043 Views)