4

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?

2
  • Do you mean Windows BATCH file? Or do you actually have GNU Bash installed on Windows?
    – Zoredache
    Oct 3, 2010 at 8:34
  • Windows BATCH file Oct 3, 2010 at 8:46

2 Answers 2

6

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%

3

In Windows:

exit /b 1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .