LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

batch file in a loop

I am trying to run a batch file repetitively in a loop. The batch file uses other text files. The first time the batch is executed (using Exec in LabVIEW 5.1) it works fine, but in subsequent loops I get the following error message.

The process cannot access the file because it is being used by another process.

Suggesting that the files read within the Batch file have not been closed within the batch file? What can I do to make this batch file run every loop?

If the program is simply stopped and restarted then again the first iteration is fine. Is this an inherent problem with Exec?
0 Kudos
Message 1 of 3
(2,976 Views)
The only inherent problem I remember from the system Exec in this version of LabVIEW is that it didn't give you the ability to wait until completion. It's possible that your batch hasn't finished by the time your loop executes again. Aside from upgrading, you can getter a better System Exec in the windows utility lvwutil32.llb. You can download it here
0 Kudos
Message 2 of 3
(2,976 Views)
You didn't by chance wire the "Wait Until Completion" input to False? I
have tried a couple of simple batch file calls from a System Exec.vi in a
loop and can't duplicate your problem. It does sound like the files are not
being closed in time for the next call. Try a delay in the loop to see if
that clears it up. Possibly the tasks being called by the batch file allow
the batch file to return to the caller (System Exec.vi) prior to completing
their tasks.

Good luck.


"DanC" wrote in message
news:50650000000800000091420000-1017707437000@exchange.ni.com...
> I am trying to run a batch file repetitively in a loop. The batch
> file uses other text files. The first time the batch is executed
> (using Exec in LabVIEW 5.1) it works fine, but in subsequ
ent loops I
> get the following error message.
>
> The process cannot access the file because it is being used by another
> process.
>
> Suggesting that the files read within the Batch file have not been
> closed within the batch file? What can I do to make this batch file
> run every loop?
>
> If the program is simply stopped and restarted then again the first
> iteration is fine. Is this an inherent problem with Exec?
0 Kudos
Message 3 of 3
(2,976 Views)