LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system exec.vi is including the input string in the output, why?

I use system exec.vi all of the time. It usually works great but today in only some instances of that vi in my code, it takes the 'command line' input string and adds it to the beginning of the 'standard output' string. Its weird because it is not happening at other instances of the vi. I've tried putting the command in a batch file and out of a batch file, it still does it. Just adds more poo to the output string to parse.

Its messing up my parsing of the output string. Please help if you have any ideas.

Thanks.

0 Kudos
Message 1 of 8
(3,726 Views)

Hi ParseMe.

 

Is it only a certain command or set of commands that you're seeing this behavior with?  If so, what are these commands?  In other words, for an instance that is not working properly, if you change the command line input to something else, does it still behave improperly or does it work as expected?

 

It may also be beneficial to post a screenshot of your block diagram if possible.

 

Thanks,

 

Michael G

Michael G.
Applications Engineer
National Instruments
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Self-realization: I was thinking of the immortal words of Socrates, who said, "... I drank what?"
0 Kudos
Message 2 of 8
(3,708 Views)

Michael,

Q1: Yes. That is correct.

Q2: When I run a specific executable, it doesn't include the path and the command line string that was input. When I ran Windows commands ( to give a list of files), it puts in the path of where the VI is located, followed by a greater than bracket ">" , followed by the command from the input string, followed by the output from the command.

Q3: I tried that and it worked properly with a different command. (I copied the command "tool.exe -c hget"). The output was identical to the first.

I included a screen shot. Apologies if it looks confusing ( i had to remove pathnames). Basically just look at how both of the system exec.vi's are setup and how they produce different output.

 

Thanks for your help!

 

Sincerely,

 

ParseMe

 

 

Download All
0 Kudos
Message 3 of 8
(3,698 Views)

You are running a batch file.  It is not including your input command which is path\rxdirB.bat, it is outputting the ouptut from your batch file.  If you run the batch file by itself, you will see it echoes the directory command.  If you are only running a directory command in the batch file, don't use the batch file and run the directory command diretcly from System Exec.

0 Kudos
Message 4 of 8
(3,677 Views)

 

AHHA!

I forgot to turn the echo off in the batch file.

 

I had to use a batch file because system exec.vi does not like Windows command line arguments. I was getting LabView errors (#2) until I put it in a batch file.

 

Thanks Michael!

0 Kudos
Message 5 of 8
(3,672 Views)

Use cmd /c, i.e. cmd /c dir c:\temp.  I usually put quotes around the cmd jsut to be safe, i.e. cmd/c "dir c:\temp" but the quotes are not always necessary.

0 Kudos
Message 6 of 8
(3,668 Views)

OH that DOES work!

I tried that yesterday and it didn't work. I probably typod it in there wrong.

🙂

Thanks again!

0 Kudos
Message 7 of 8
(3,665 Views)

One thing to remember: System Exec is equivalent to selecting Start -> Run and entering the command in that little dialog box. It's not the same as typing something into a command window. That's why the suggestion of using "cmd /c", as that creates a shell in which the command can run. This is not always necessary, but in some cases it is.

0 Kudos
Message 8 of 8
(3,651 Views)