LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system exec: Bad execution of commands

Hi all, 

I'm curretly using the System Exec VI tool under labview 8.6 in order to execute dos batch files.
First of all, all batch have been previously tested and worked perfectly called manually.
When I try to call them with Labview using System Exec VI, some are executed and some not. For instance the command FC (file compare).

cmd /c fc test1.txt test2.txt >result.txt(compare test1 and test2 and put the result in result.txt) doesn't work under labview (see attached file)

command diff also doesn't work properly, and many other..

I think there is a problem with the redirection symbol ">" but not sure at all!

Hope someone could help me

Many thanks in advance

0 Kudos
Message 1 of 15
(6,185 Views)

Hi gueurg,

did you try it with quotation marks, like this: cmd /c fc "test1.txt test2.txt > result.txt"?

There is no attachment in your first post. 

 

Mike

Message 2 of 15
(6,180 Views)

Hi Mike,

 

Thanks for your reply, but i've already tryed with "" unfortunately with no effect. 

What's actually strange,  is that other commands like echo, ping, dir... which are not involving other files or file handling are working normaly, but once i want to use other commands which open a file to modify it and write in another file, in this case something's going wrong.

It's not easy for me to understand, why the commands are working whithout trouble "manually" and with System Exec VI just some of them?

 

Thanks

 

Gueurg 

0 Kudos
Message 3 of 15
(6,174 Views)

Hi Gueurg,

 

I tried this command , it is working fine . Iam  not getting any error.

 

cmd /c ipconfig>>Res.txt or cmd /c "ipconfig>>Res.txt" both are working fine.

 

Have u specified the working directory as C:\? 

 

 

Rgds,

Venky

0 Kudos
Message 4 of 15
(6,165 Views)

Hi Venky and thank you for your interrest.

 

Your example is also working well under my application, and as i saied, all commands are not concerned.

Look at the files attached, it's a simple batch which compare two tex file test1 and test2 and put the result in res.txt. Try it manually and then through System exec VI. the result is not the same . 

 

Many thanks to you 

0 Kudos
Message 5 of 15
(6,154 Views)

How funny... fc.exe really have a troubles with output when called from SystemExec.

 

What you can do, is following:

create *.bat file, then call it from System Exec+.vi from WinUtil instead of "embedded System Exec".

Just checked, it works.

 

Andrey.

 

0 Kudos
Message 6 of 15
(6,132 Views)

Hi Andrey, thanks to you,

 

Could you give more details about your solution?  you know i'm beginner in labview so...

 

Thanks 

 

Gueurg 

0 Kudos
Message 7 of 15
(6,125 Views)

I think you need to specify the full path for the files. Take a look at this site http://www.computerhope.com/fchlp.htm. Anyway you may test the command by opening a "command window" go to run in the windows start menu and type cmd. This will open the Dos shell. In this window you do no not need the cmd /c part



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 8 of 15
(6,118 Views)

Hi, all my batch have been previously tested under "command window" and work perfectly!

I would like to add that "fc" command is just an example,  other commands like:

-sed

-diff

-cmp 

are making troubles as well.

 

I can't imagine  that i'm the only one to have this problem.

Thanks

 

Gueurg 

 

0 Kudos
Message 9 of 15
(6,109 Views)

t06afre, have you tried this? With cmd /c or without cmd /c, called from *.bat file or directly from LabVIEW — fc.exe doesn't work when called through system exec. Try this, please.

 

gueurg, working example, including lvwutil32 in attachment.

 

Andrey.

 

0 Kudos
Message 10 of 15
(6,108 Views)