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.
已解决! 转到解答。
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.
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.
Did you put the "cmd /c" before the program to run?
@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.
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".