ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system exec.vi labview application

Solved!
Go to solution

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.

0 Kudos
Message 1 of 10
(6,108 Views)

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.

0 Kudos
Message 2 of 10
(6,093 Views)

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.

0 Kudos
Message 3 of 10
(6,091 Views)
Solution
Accepted by jachy25

Did you put the "cmd /c" before the program to run?



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 10
(6,078 Views)

crossrulz,

Thank you! That did the trick. Is there any way to close the cmd right after it launches the program?

0 Kudos
Message 5 of 10
(6,074 Views)
There are options on the SystemExec.vi for that. You should really read the hep file on it.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 10
(6,049 Views)

@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.

0 Kudos
Message 7 of 10
(6,028 Views)

Thanks for the help and great explanations guys 🙂

0 Kudos
Message 8 of 10
(5,978 Views)

Hi,

 

I'm not quite sure what you mean - will you mind explaining in a bit more detail. I have the same problem.

0 Kudos
Message 9 of 10
(5,763 Views)

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".

0 Kudos
Message 10 of 10
(5,749 Views)