1.

Solve : pass a value from a batch file once completed?

Answer»

I NEED to pass a parameter (pass/fail or 1/0) from a batch file if a condition is met within it. I think I can do it by creating a registry key and setting it to a 1 or 0. Is there a better or more efficient way to do this?

This 1/0 or pass/fail will then be read by a separate application (National Instruments Labview). Thanks in advance.I think this will work on Win2000:

Code: [Select]exit /b [returncode]

The /b switch will return control to the command window, not shut it down. The returncode will be placed in errorlevel where it can be TESTED in the normal batch ways.

Mucking around with the registry SEEMS a bit overkill. Thanks for the reply but I believe I am doing what you propose already.

Within my batch file, I look at the errorlevel to determine within the batch file WHETHER it is a 1 or 0. How do I see from a separate application (NI Labview) wheter that value is a 1 or 0? Thanks.Quote

Within my batch file, I look at the errorlevel to determine within the batch file whether it is a 1 or 0.

What condition produces a 1 or 0 errorlevel? What action does the batch file take? If you were to put this value in the registry does Labview have a mechanism to read it?

Can Labview read arguments on the command LINE? If so, this might work provided Labview knew what the command line data represents.

Perhaps Labview can test the condition that produced the 1 or 0 errorlevel and determine for itself what action to take.

Post the batch file. It should help us see what direction you're going with this. It works by having Labview read the registry entry. My batch file writes either a 1 or 0 depending on the if statment. It works fine, I just do not like messing around with the registry.

I believe what I will do is have the batch file create a .txt file if the else condition occurs and have Labview check to see if the file exists. From checking on this forum and others, this appears the least troublesome way to do it. Thanks again for your help.


Discussion

No Comment Found