LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System Exec v. Cmd line differences

From the DOS command line, I can start an external program; tell the program a file to open; and activate some switches.  From system exec, the program can't find or open its open file, althougth the error seems to have the correct file name.  What could be the problem? I've tried all sorts of variations in configuring the LV code.

0 Kudos
Message 1 of 4
(2,194 Views)

I've recently had similar difficulties.  I've found:

1)  use a System Exec command similar to  "cmd /c c:\*\myBatch.bat"

2) create a .bat file to run instead of trying to run the program directly

3) avoid spaces in names.

4) Your batch file will probably look like:

 

Path=C:\Program Files\My Program

myprogram.exe -a -b -c

 

Adam

0 Kudos
Message 2 of 4
(2,184 Views)

The thing you have to remember is that System Exec is really more like using the Start -> Run command. It is not the same as having a command window open. Thus, if you cannot enter a valid command via Start -> Run, then your command will not work with System Exec as is. Usually you can use cmd /c or cmd /k as suggested to get the command window "environment". In some cases you need to resort to a batch file to get it working.

0 Kudos
Message 3 of 4
(2,181 Views)

The problem was the extra line feed after the command.

Thanks.

0 Kudos
Message 4 of 4
(2,176 Views)