anchor.diff:          echo %_PREFIX% ERROR: ROOTDIR "%_ROOTDIR%" does not appear to be a Cygwin directory.
           exit /b 1
       :endif_cygwin_ico
  -goto :eof
  +exit /b 0
  +
   
   :check_admin
       rem Check for ADMIN privileges
  
positive.code: rem Uninstall Cygwin.
  rem See http://cygwin.com/faq/faq-nochunks.html#faq.setup.uninstall-all
  rem
  
  setlocal
  
  set _ROOTDIR=C:\cygwin
  set _PREFIX=CYGWIN-UNINSTALL:
  
  goto :main
  
  
negative.code:     reg delete HKCU\Software\Cygwin /va /f > NUL: 2>&1
  goto :eof
  
  
  :remove_cygwin_dir
      echo %_PREFIX% Removing %_ROOTDIR%
      rd /s /q %_ROOTDIR%
  goto :eof
  
  
  :remove_shortcuts
      echo %_PREFIX% Remove Cygwin shell shortcuts from Desktop and Start menu!
  goto :eof
  
  
  :remove_local_users
      echo %_PREFIX% Remove sshd and cyg_server local users!
  goto :eof
  
  
  :main
      call :check_rootdir ||exit /b 1
      call :check_admin ||exit /b 1
      call :uninstall_lsa ||exit /b 1
      call :stop_services
      call :check_for_cygwin_proc ||exit /b 1
      call :remove_services
      call :clean_registry
      call :remove_cygwin_dir
      call :remove_shortcuts
      call :remove_local_users
  