@echo off
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
  set "DEL=%%a"
)

cd /d %~dp0
echo Generate random password...
rftd -q -s create_user_pwd=1
for /f "tokens=1,2* delims==" %%i in ( 'rftd -q -p' ) do if "%%i"=="ftpd_login_user" set rftd_login_user=%%j >NUL
for /f "tokens=1,2* delims==" %%i in ( 'rftd -q -p' ) do if "%%i"=="ftpd_login_passwd" set rftd_login_passwd=%%j >NUL

echo ==============================================
call :ColorText 04 "user= %rftd_login_user%" 
echo.
call :ColorText 04 "pwd= %rftd_login_passwd%" 
echo.
echo ==============================================

if "%1"=="" pause
goto :eof

:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof

