@echo off
cls
Echo.
echo Reset NT (2k/XP/Vista) passwords with a bootable CD/USB-Stick
echo.
:_med
Set /P med=What medium do you want to create (CD, USB)?:
if "%med%"=="CD" goto _cd
if "%med%"=="USB" goto _usb
 goto _med
 
:_cd
cls
echo.
echo To create a CD please burn the ISO-Image
echo.
echo  %systemdrive%\programs\ntpwchg\cd070927.iso
echo.
echo on a CD. 
echo.
echo To reset passwords boot the target system with the created CD.
echo.
goto _end

:_USB
cls
echo.
echo Reset NT (2k/XP/Vista) passwords with a bootable USB-Stick
echo.
Set /P med=Enter drive letter of the USB-Stick to use (c, d, ...):
Echo.

if exist "%med%:" goto _space
echo !!!!!!!!!!!!!!!!!!!!!!!!
echo ! no drive %med%: found 
echo !!!!!!!!!!!!!!!!!!!!!!!!
goto _end

:_space
%systemroot%\system32\freedisk %med%: 3000000
if errorlevel 0 goto _ask
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo ! not enough space on drive %med%:
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
goto _end

:_ask
Echo. 
Set /P YESNO=Is %med%: the drive of the USB-Stick to use: (Y/n)?
Echo.
if "%YESNO%"=="Y" goto _go
if "%YESNO%"=="n" goto _end
goto _ask
:_go
xcopy "%systemdrive%\programs\ntpwchg\usb\*.*" "%med%:\" /Y/Q/E/I
if not exist "%med%:\syslinux.exe" goto _errorcopy
%med%:
syslinux.exe -ma %med%:

    echo.
    echo data was tranfered to the USB-Stick on drive %med%:.
    echo.
		echo To reset passwords boot the target system with the USB-Stick.
		echo.
goto _end

:_errorcopy
    echo.
    echo !An error occured!
    echo Data was not tranfered successfully to the USB-Stick on drive %med%:.
    echo.
	
:_end
pause
