12-23-2015 08:54 AM
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!
12-23-2015 09:25 AM - edited 12-23-2015 09:27 AM
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).
12-23-2015 09:29 AM
Yup, sounds like a path issue to me.
Use the complete path to your executable in the system exec command line.
12-23-2015 09:30 AM
12-23-2015 09:34 AM
@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.
12-23-2015 09:36 AM - edited 12-23-2015 09:37 AM
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.
12-23-2015 09:48 AM