LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system exec

I have written a DOS application and use the "system exec" sub-vi to execture.  It was running fine until I made a change to the DOS application.  The System Exec insists on executing the old version of the DOS program.  When I change names of the application, I'll then get an error code 2.  I have a suspicion that the DOS executable is copied someplace and it's that copy the System Exec insists on running.

 

The DOS executable resides on another PC on the network whose directory I've mapped to a drive letter.  I can copy the executable to a local directory, the same one with my VI, and it doesn't care.  I run the program from the command line, and it executes as expected and produces the new output.  The VI app runs the software, too, but produces the output of the old version.

 

I've modified the command string with "cmd /c" prepended to the actual command; e.g.,

 

Original:  "ppt arg1 arg2" -> Old output

 

Update: "cmd /c ppt arg1 arg2" -> New output

 

What is going on withing the system exec that it gets so particular?

 

Thanks!

Message 1 of 7
(3,351 Views)

In your application, how are you specifying the path to the command-line executable?

 

From your description - it looks like you're just calling 'ppt' - which means that you must have the directory of the command-line executable added to the PATH environment variable so the command-prompt knows to look there for it.

 

I can guarantee that LabVIEW isn't magically 'copying' the executable somewhere to run it (unless your software instructs it to do that).

 

You might have more luck if you specify the path to the executable directly (e.g. using format into string, remembering to put quotes around the path if it contains spaces).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 7
(3,334 Views)

Yup, sounds like a path issue to me. 

 

Use the complete path to your executable in the system exec command line.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 7
(3,324 Views)
In the system exec I specify the working directory on the input side of the vi, which hasn't given me any difficulty. It is curious, though, that it insists on calling the old version, in spite of my attempts to rename it, and even move it, if I don't specify the "cmd /c" as part of the command.
0 Kudos
Message 4 of 7
(3,316 Views)

@RT1956 wrote:
In the system exec I specify the working directory on the input side of the vi, which hasn't given me any difficulty. It is curious, though, that it insists on calling the old version, in spite of my attempts to rename it, and even move it, if I don't specify the "cmd /c" as part of the command.

Put the entire path to your executable in the command line.

 

 

========================
=== Engineer Ambiguously ===
========================
Message 5 of 7
(3,310 Views)

I believe the working directory is passed to the calling application, and does not specify the path to the executable. If your old executable path is in the PATH environment variable, regardless of what your 'working directory' is, it will call the one specified in PATH.

 

To specify the executable to run, you must specify the exact path, or it will call one that it finds in the PATH environment variable.


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 6 of 7
(3,307 Views)
Thanks, All! I'll be more explicit.
0 Kudos
Message 7 of 7
(3,299 Views)