02-16-2009 03:10 AM
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
02-16-2009 03:44 AM
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
02-16-2009 04:05 AM
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
02-16-2009 04:24 AM
02-16-2009 04:44 AM
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
02-16-2009 06:03 AM
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.
02-16-2009 06:27 AM
Hi Andrey, thanks to you,
Could you give more details about your solution? you know i'm beginner in labview so...
Thanks
Gueurg
02-16-2009 06:45 AM
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
02-16-2009 06:57 AM
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
02-16-2009 06:59 AM
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.