Horribly Newbie question, but something that I have never really quite understood. How does one write an if exist within an if exist statement.

For example, one would write

 Code:
if exist x = 0
? "do whatever"
else
Endif

Thats pretty straightforward

But what if you want to do this:

 Code:
if exist x = 0
? "do not do anything"
Else
if exist y = 0
"Then we need to do this"
else
Endif

The code that I am using is this:

 Code:
;=============================================================================================
; remove picture icon on Windows 7 login only if BackgroundDefault.jpg picture actually exists
;=============================================================================================

If exist ("%windir%\system32\oobe\Info\Backgrounds\BackgroundDefault.jpg") = 0
? "do not change the Windows 7 Login Look"
Else
If exist ("%windir%\system32\authuiobsolete.dll") = 0
shell 'takeown /a /f %SystemRoot%\System32\authui.dll'
shell 'ICACLS %SystemRoot%\System32\authui.dll /Grant Administrators:F'
? "removing the Picture Icon on windows 7 login screen"
move ("%windir%\system32\authui.dll") ("%windir%\system32\authuiobsolete.dll")
copy ("\\" + $MyDomain + "\netlogon\patches\authui.dll") ("%windir%\system32\authui.dll")
Endif



What this does is the backgrounddefault picture does not exist, I don't want the script to do anything. However if the background picture does exist, then I want the script to check for the existence of a file. If that file does not exist, then I want the script to execute the functions.

My problem has always been that I have been forced to use goto to get around the problem of an if exist statement not working within an if exist statement. The documentation does not help as it does not seem to cover this problem. Using case is only useful if you are using 3 conditions or more which is not applicable in this instance.

So how does this dumb newbie (ME) write an if exist within an if exist statement and get it to work!
Thanks