ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system exec.vi command prompt window .exe

Solved!
Go to solution
0 Kudos
Message 1 of 9
(6,057 Views)

My mother taught me never to down load anything unless I trust the source.

 

Well how else am I supposed to reply to a post like this?

 

Please post some words that tempt us into helping out.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 9
(6,048 Views)
Do you have a question or do you just get a kick out of randomly posting code?
0 Kudos
Message 3 of 9
(6,043 Views)

Sorry, for the missing text...

 

I'm having a problem with System Exec.vi.

 

I modified a MIL-STD-1553 PCMCIA adapter program originally written in C++ as a command line executable program to output the results of the self-test to a text file called "SelfTest.out". 

 

When I run the program "modified.tester.exe" in command prompt window it runs fine and outputs the file as intended.

 

I use the following statement at the prompt, with arguments as shown, to run the program:

 

d:\temp4\modified.tester 2 0

 

However when I try to run it using the System Exec.vi the command prompt window flashes briefly but the program does not output the "SelfTest.out" file.

 

I've tried running it using the following statements cmd.exe /c, cmd /c, and command.com /c prior to the path statement above but still do not get the proper output file.

 

Any help would be appreciated.

0 Kudos
Message 4 of 9
(6,039 Views)

In general, when using System Exec.vi you should be sure to specify the working directory (ie. the path to your executable) in the VI.  Your command line should then simply be the executable name and parameters.  To read the file, just build the path using the working directory plus the name of the file you output.

 

In this case it looks like "d:\temp4\" should be the working directory.  The command line should be 'modified.tester 2 0'

Message 5 of 9
(6,018 Views)

Darin,

 

Thanks for the quick reply. I just tried your suggestion but, unfortunately, it didn't work.

 

In fact I've tried it, and numerous other variations of inputs and settings (wait till completion t/f...., run minimized t/f..., ect.) all to no avail.

 

It almost seems as if System Exec.vi doesn't pass the command properly or times out prematurely.

 

In trouble shooting this problem I've tried putting a pause statement in the C++ code for the "modified.tester.exe" program prior to the program's final return statement. When run in a command prompt window, the command prompt would display "press any key to continue" to force the user to manually hit a key to close the window. A "SelfTest.out" file would then be created.

 

However, running that same program from the System Exec.vi, would open the command prompt window with no text displayed, and when any key was pressed the window would close but no "SelfTest.out" file would be created.

 

 

0 Kudos
Message 6 of 9
(6,006 Views)

bat files are far away and long ago but

 

How about using a bat file and adding an extra carrige return?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 9
(6,003 Views)
Solution
Accepted by topic author bithead

I think that Bat Man (aka Ben) has a good idea.  I was a bit ahead of myself, the working directory will specify where the file is written, the full path to the executable must be specified in the command line.

 

Works for me (other than the fact that the text file says there was some registry error).

Message 8 of 9
(5,990 Views)

That did it. Thanks.

 

I needed to include the full path in the command line to get it working right.

 

The error in the text file is a normal indication. Since you don't have the specific PCMCIA 1553 adapter card or the drivers for it loaded on your system it will return an error.

 

Thanks again,

 

Paul

0 Kudos
Message 9 of 9
(5,983 Views)