title: Is it possible to run an "If" statement within another "If" statement?
body: <p>I'm trying to create a script that will check to see if folder <code>X</code> exists and then check to see if folder <code>Y</code> doesn't exist before executing code.</p>
  
  <p>Essentially here is what I'm trying to accomplish:</p>
  
  <pre class="lang-none prettyprint-override"><code>If "X" folder exists Then
    If "Y" folder doesn't exist Then
      Create "Y" folder
      Create Message box
      Run "Z" CMD file
  IF "X" folder doesn't exist Then
    Create "Y" folder
  If both "X" and "Y" folder exist then 
    Do Nothing
  End IF
  </code></pre>
  
  <p><strong>Note:</strong> The problem I'm having is that I can get it to do a variation of 2 of the 3 <code>If</code> statements, but never all 3 to work as desired. Here is the script I'm currently using. I've tried using <code>Else</code>/<code>ElseIf</code> as well and just can't seem to get them working. Here is the script I'm currently using:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Set WshShell = CreateObject("Wscript.Shell")
  vAPPDATA = WshShell.ExpandEnvironmentStrings("%APPDATA%")
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  If Not objFSO.FolderExists(vAPPDATA &amp; "\Mozilla\Firefox") Then
      objFSO.CreateFolder(vAPPDATA &amp; "\Mozilla\Update1")
      End If
  If objFSO.FolderExists(vAPPDATA &amp; "\Mozilla\Firefox") Then
      If Not objFSO.FolderExists(vAPPDATA &amp; "\Mozilla\Update1") Then
          objFSO.CreateFolder(vAPPDATA &amp; "\Mozilla\Update1")
          x=msgbox("Firefox has been updated and will need to close and reopen to import your profile." ,0, "Firefox Has Been Updated!")
          Dim objShell
          Set objShell = CreateObject("WScript.Shell")
          objshell.run (VAPPDATA &amp; "\test.cmd")
          End If
      If objFSO.FolderExists(vAPPDATA &amp; "\Mozilla\Update1") Then
          End If
      End IF
  </code></pre>