nativecolorado Posted March 19, 2009 Share Posted March 19, 2009 I'm using AutoIt to write a portion of our logon script. I need to determine the OS for logic in the batch file we run at logon.AutoIt code to set the $OSCode variable is as follows:*******************************************If @OSVersion = "WIN_2000" Then $OSCode = 50ElseIf @OSVersion = "WIN_XP" Then $OSCode = 60ElseIf @OSVersion = "WIN_VISTA" Then If @OSArch = "X64" Then $OSCode = 72 ElseIf @OSArch = "X86" Then $OSCode = 70 EndIfElse $OSCode = 99EndIf*******************************************When done, I exit the AutoIt script using this line:*******************************************Exit ($OSCode)*******************************************which passes the %ERRORLEVEL% value to the batch file. Or is SUPPOSED to.Here's the problem:In XP, when I echo %ERRORLEVEL% in my batch file, I get '60' displayed, as I should. Everything works perfect.In Vista 32-bit or 64-bit, when I echo %ERRORLEVEL% in my batch file, I get '0'. The logic in the batch file fails due to the zero being returned.When I run the compiled AutoIt script on Vista, it returns the proper OS Code (70 or 72, depending on 32-bit or 64-bit Vista.) But passing the %ERRORLEVEL% is failing in all versions of Vista.Anyone got any ideas? Link to comment Share on other sites More sharing options...
Authenticity Posted March 19, 2009 Share Posted March 19, 2009 What about "IA64"? add it as the Else case. Link to comment Share on other sites More sharing options...
nativecolorado Posted March 19, 2009 Author Share Posted March 19, 2009 The AutoIt portion is working. When I run the compiled .exe on Vista 32 or Vista 64 it returns the proper value-70 or 72. It's just when passing THAT value back to the batch file that Vista seems to be losing it, and is resetting the %ERRORLEVEL% back to the default of zero. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now