09-29-2014 03:09 PM
Hi everyone,
I'm having a problem with system exec.vi. I simply want to open another program using labview. This works whenever I try to access it using the VI. However, when I turn the VI into an executable, the system exec.vi doesn't do anything. I'm running a windows xp machine. I have tried it with a windows 7 machine and still nothing. any help would be appreciated. Thanks.
Solved! Go to Solution.
09-29-2014 03:24 PM
Are you using a relative path to the EXE? If so, LabVIEW may report a different path when a VI is compiled into an executable, so a path relative to a VI's path may be wrong.
09-29-2014 03:27 PM
Hey nathand,
I'm not really sure what you mean. The only thing I have connected to the system exec VI is the path to the program. It's also installed at the same place in both the windows 7 machine and the windows xp machine.
09-29-2014 03:37 PM
Did you put the "cmd /c" before the program to run?
09-29-2014 03:48 PM
crossrulz,
Thank you! That did the trick. Is there any way to close the cmd right after it launches the program?
09-29-2014 05:58 PM
09-29-2014 07:11 PM
@jachy25 wrote:
Hey nathand,
I'm not really sure what you mean. The only thing I have connected to the system exec VI is the path to the program. It's also installed at the same place in both the windows 7 machine and the windows xp machine.
Obviously this wasn't the issue, but to clarify: a relative path means you're providing a path relative to some other item. For example, if you were generating the path to the EXE by using the "Current VI's Path" function and then using Strip Path/Build Path, that would be a relative path. The "Current VI's Path" function may return a different path inside an executable than in the development environment, so that could cause the issue you describe.
If you're referencing the external program with an absolute path (ie "C:\Program Files\Vendor\program.exe") then this isn't an issue, of course.
09-30-2014 01:41 PM
Thanks for the help and great explanations guys 🙂
11-24-2014 04:36 AM
Hi,
I'm not quite sure what you mean - will you mind explaining in a bit more detail. I have the same problem.
11-24-2014 11:50 AM
Which part isn't clear? The accepted solution says to prepend "cmd /c " to the command line string input to System Exec. For example if you wanted to execute notepad.exe, the command line would be "cmd /c notepad.exe".