Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- cls
- :enter_name
- set /p NAME="Enter user name (4 characters): "
- goto checklen
- :reenter_name
- echo Name should be 4 chars length! Enter another one
- goto enter_name
- :checklen
- call :strLen NAME LEN
- if not %LEN% == 4 goto :reenter_name
- set USERNAME=UPart2%NAME%
- set GROUPNAME=GPart2%NAME%
- net user %USERNAME% /add
- net localgroup %GROUPNAME% /add
- net localgroup %GROUPNAME% %USERNAME% /add
- net user %USERNAME% /active:yes
- net user
- net localgroup
- net localgroup %GROUPNAME%
- pause
- exit /b
- :strLen strVar [rtnVar]
- setlocal disableDelayedExpansion
- set len=0
- if defined %~1 for /f "delims=:" %%N in (
- '"(cmd /v:on /c echo(!%~1!&echo()|findstr /o ^^"'
- ) do set /a "len=%%N-3"
- endlocal & if "%~2" neq "" (set %~2=%len%) else echo %len%
- exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement