12-17-2012 06:51 PM
Hi there,
I had a weird problem: I have to set "Wait Until Completion" to F in order to make my vi work properly work when I pass param to system exec.vi, otherwise the .exe that I'm calling will be crashed. But I need to get the result from standard output, so I need to set "Wait Until Completion" to Ture. Please see attached picture. Can anyone help? Greatly appreciate about it!
Thanks,
Weny
12-17-2012 08:17 PM
What VISA resource are you closing after you run the System Exec.vi?
12-19-2012 01:10 PM
I use COM11, this is a virtual USB serial port in windows 7. The .exe I'm calling is same as Hyperterminal transfer a file via Xmodem and the language I'm using for this exe is VB(.net), and the binary file I'm tranferring is a voice prompts file(audio).
Thanks!
Weny
12-19-2012 02:41 PM
I don't know why what you are seeing happens, but I can offer a solution that I have tried a few times when System Exec.vi did strange things. Write the command itself to a temporary batch file and then execute the batch file.
Also shouldn't there be a "\" after the colon in the file name?
Mike...
12-19-2012 03:45 PM
If I want to use a batch file, is the command line input " cmd /c runme.bat "?
The content in runme.bat is "mercierxmodem COM11 c:\MercierPromptsEN.bin"
For Also shouldn't there be a "\" after the colon in the file name?
If you mean the working directory, Labview added the "\" automaticlly...
12-19-2012 03:56 PM
No, the command line input would just be "runme.bat".
In the snippet that you posted, there is no "\" in the command line. It read cmd /c "mercierxmodem COM11 c:MercierPromptsEN.bin"
Mike...
12-19-2012 04:04 PM
my runme is "mercierxmodem COM11 "xmodem" c:\MercierPromptsEN.bin". I run this at cmd.exe, it works fine. But when I send "runme.bat" to command line in system exec.vi, it gives me an error 2 no matter I set Wait until Completion to T or F.
12-19-2012 04:10 PM
I'm sorry, you have to give the whole path to the temporary batch file. If you create the batch file in the LV temp directory, it will be a simple matter to find it.
Mike...
12-19-2012 04:28 PM
Sorry Mike, I think I'm kind of lost: do you mean I should give a whole path about the batch file (runme.bat) to the working directory of system exec.vi?
12-19-2012 04:45 PM
No the command line should be the entire path to the batch file. Say the file is in a directory called my_batches off the root of your c drive. The command line would be:
c:\my_batches\temp.bat
Using the LV temp directory node (as in my snippet) allows you to build the path easily - you will of course need to convert the path into a string.
Mike...