mercredi 6 mai 2015

Batch file reject blank entry not working

I'm working through some code, and I need to reject a blank value but accept everything else; I can't see to do it... Does anyone have pointers, or could even fill it in for me...

:2
REM Basic account creation
echo Welcome to basic account creation.

REM user enters details
REM Username
echo Please Enter a Username
set /p username=
if "%username%"=="" (
goto 2
) else if not "%username%"=="" (
echo.
REM Real Name
echo Please enter your full name
set /p fullname=
echo.
REM Password
echo Please enter a password
set /p password=
echo.
)
REM Save to file
if exist %username%.log (
echo User name already exists, please enter a new user name to create an account, or return to the log in screen    
    goto 1
) else (
    echo %fullname% >> %username%.log
    echo %password% >> %username%.log
    echo %date% %time% >> %username%.log )
timeout /t 2 /nobreak > NUL
REM pause
if exist %username%.log (
echo. )
timeout /t 1 /nobreak > NUL
    goto 6

Aucun commentaire:

Enregistrer un commentaire