@ECHO OFF
:: ======================================================================
:: File:		REMOVE.BAT
:: 
:: Contains:	This removes the Virtual PC drivers under Windows 2000/XP.
:: ======================================================================

:: Save the current directory
PUSHD

:: Is this Windows NT or Windows 2000/XP?
VER | FIND /I "Windows NT Version 4.0">NUL
IF NOT ERRORLEVEL 1 GOTO Fatal_WrongSystemVersion

:: Enable command extensions - See HELP SETLOCAL for information on the
:: following idiom.
VERIFY OTHER 2>NUL
SETLOCAL ENABLEEXTENSIONS
IF ERRORLEVEL 1 GOTO Fatal_UnableToEnableExtensions

:: The source directory may be specified in the second batch parameter.
:: If the source directory is not specified, assume the source directory
:: is the current directory.
IF NOT [%2]==[] CD /D %1
FOR /F "delims=" %%A IN ('CD') DO SET CurDir=%%A

:: Remove the drivers
RUNDLL32 "%CurDir%\InstSrvc.dll",RemoveNetworkDriver

:: Notify user to restart
ECHO Restart to complete uninstallation of the driver...
PAUSE
GOTO End

:Fatal_UnableToEnableExtensions
ECHO ERROR: Unable to enable command extensions.
GOTO End

:Fatal_WrongSystemVersion
ECHO ERROR: This uninstall will only function under Windows 2000 or later

:End
ENDLOCAL

:: Restore the current directory
POPD
