Jump to content
Ketarin forum

Exit 2 not ending the script


Omniferum
 Share

Recommended Posts

This piece of code use to work fine

 

 

::Keep this if your file cannot be installed and/or downloaded automatically and needs to be processed after Ketarin finishes
for /f "tokens=*" %a in ('wmic path win32_VideoController get Name ^| findstr "ATI"') do set displaydriver=%a
if defined displaydriver exit 2
START CMD /C "ECHO {appname}: This applications installation will start after you hit any key, wait for Ketarin to finish & PAUSE & "{file}""
&

 

But I had to change it to this because it kept processing the rest of the script regardless of the exit 2

::Keep this if your file cannot be installed and/or downloaded automatically and needs to be processed after Ketarin finishes
for /f "tokens=*" %a in ('wmic path win32_VideoController get Name ^| findstr "ATI"') do set displaydriver=%a
if defined displaydriver exit 2 else (START CMD /C "ECHO {appname}: This applications installation will start after you hit any key, wait for Ketarin to finish & PAUSE & "{file}"" &)

 

 

Is this intentional? I relied on exit 2 in a bunch of scripts as it just ended the script and 'exited' then and there.

Link to comment
Share on other sites

  • 2 weeks later...

12/11/2011 7:07:08 PM: Nvidia Driver (Win7 x64): Executing command: for /f "tokens=*" %a in ('wmic path win32_VideoController get Name ^| findstr "ATI"') do set displaydriver=%a
12/11/2011 7:07:08 PM: Nvidia Driver (Win7 x64): Executing command: if defined displaydriver exit 2
12/11/2011 7:07:08 PM: Nvidia Driver (Win7 x64): Executing command: START CMD /C "ECHO Nvidia Driver (Win7 x64): This applications installation will start after you hit any key, wait for Ketarin to finish & PAUSE & "Z:\Software\Automatically Updated\Driver\285.62-desktop-win7-winvista-64bit-english-whql.exe""

 

This is on Windows 7 Ultimate 64-bit. I'm not sure why the OS would matter as it worked pefectly fine before. It seems to be with the if defined concept of the batch file and doesn't actually check it.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.