Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can I return a value in a Windows batch file? I can do it in Unix using exit 1 but how can I do it in Windows?

share|improve this question
    
Do you mean Windows BATCH file? Or do you actually have GNU Bash installed on Windows? –  Zoredache Oct 3 '10 at 8:34
    
Windows BATCH file –  Mohammad AL-Rawabdeh Oct 3 '10 at 8:46
add comment

2 Answers

up vote 4 down vote accepted

In a windows batch file to return a value back to the command shell use

exit /b yourexitcode

e.g

exit /b 3

will retun 3 in %ERRORLEVEL%

share|improve this answer
add comment

In Windows:

exit /b 1
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.