NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Environment of programs started within a Teststand CVI code module

Solved!
Go to solution

Which environment is seen by an executable, which is started by LaunchexecutableEx() in an Labwindows/CVI code module using the Labwindows Adapter in Teststand ? An  is is possible to modify that environment ?

 

We've noticed that a executable, that creates directories for logging files and configuration data in its installation directory, when started standalone, now creates these directories somewhere under C:\Dokumente und Einstellungen\All Users\Dokumente\National Instruments\TestStand 4.2.1\ when started from the CVI code module.

0 Kudos
Message 1 of 2
(2,845 Views)
Solution
Accepted by markus kossmann

The executable you are using is probably adding things based on the current working directory. This is not a best practice. If you own the source code to the executeable you should consider changing it to use GetModuleFileName ( http://msdn.microsoft.com/en-us/library/ms683197%28v=vs.85%29.aspx ) passing NULL for the module handle to get the path where the executeable file is located and use that path rather than the current working directory. I'd argue that using the current working directory is almost never the correct thing for a program to do.

 

That said, if don't own the code for the executable and just need to get it working, you can use the Windows SDK function CreateProcess ( http://msdn.microsoft.com/en-us/library/ms682425%28VS.85%29.aspx ) instead which will let you specify a currentdirectory (I don't think the environment is the issue in your case, I think it is the current directory). Or you can use the TestStand call executable step type instead which has a setting for the current directory (I think it calls it the Working Directory).

 

Hope this helps,

-Doug

 

0 Kudos
Message 2 of 2
(2,830 Views)