@echo off
REM ie. --> users dBname
if exist c:\advantage\tmp\~*.* del c:\advantage\tmp\~*.*
if not exist c:\advantage\tmp mkdir c:\advantage\tmp

:start
set /p db="dB Name 		: "

osql -U sa -P advantagesystem -d %db% -Q "Select username, password from aw_users where isdbadmin=1" > c:\advantage\tmp\~isdbadmin.txt
for /F "eol=( tokens=1 skip=2" %%i in (c:\advantage\tmp\~isdbadmin.txt) do @echo %%i >> c:\advantage\tmp\~isdbadmin1.txt
if %errorlevel% GTR 0 goto nosvr

set /p user="What is your Username 	: "


:chkuser
for /F "tokens=1" %%i in (c:\advantage\tmp\~isdbadmin1.txt) do IF /I %%i EQU %user% (goto correct) else echo Username not matched with database...
Echo.
Echo Sorry, but you have no access to this information. Goodbye.
pause
echo.
goto exit

:correct
echo.
echo We have matched your username with our database,
echo.
echo.
set /p rstusr="Which username would you like to change	  : "
set /p passwd="What would you like the new password to be : "
osql -U sa -P advantagesystem -d %db% -Q "Update AW_Users SET Password='%passwd%' WHERE UserName='%rstusr%'"
echo.
pause
goto exit

:nosvr
cls
Echo That Database does not exist, please try again : 
goto start

:exit
cls
if exist c:\advantage\tmp\~*.* del c:\advantage\tmp\~*.*
exit