0

I have created a Batch file as below


SECTION 01

@echo off
setlocal EnableDelayedExpansion
echo  Type Below Requirements:
echo.
:username
set /p usr= Type Username:
if [!usr!]==[] goto username
:password
set /p pwd= Type Password:
if [!pwd!]==[] goto password
echo.
echo Your username is: !usr!
echo Your password is: !pwd!

SECTION 02

pause
net user /add %usr% %pwd% /COMMENT:"Password: %pwd%" /EXPIRES:NEVER  /PASSWORDCHG:NO /ADD
WMIC USERACCOUNT WHERE "Name='%usr%'" SET PasswordExpires=FALSE
pause
exit

I have Separate as SECTION 01 and 02 just for explanation. i.In SECTION 01 If type any symbol or space between username, should show "INVALID USERNAME PLEASE TRY AGAIN" before proceeding to password. ii. If Password Typed, should check for Password Policy before proceeding to SECTION 02.

Is it Possible, Please advice

  • I don't see any question, here. Could you edit your post to make it clearer what you're asking? – David Richerby Sep 5 '15 at 18:27
  • ex: if typing username as "user@name (Any Symbols) or user name" ,should give a error... before typing password – Adhil 1989 Sep 5 '15 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.