Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- title Administrator Menu
- color 0a
- :main
- cls
- echo **********************************
- echo *Welcome to the administrator menu*
- echo **********************************
- echo.
- TIMEOUT /T 1 /NOBREAK >NUL
- echo Please select one of the numbers below:
- echo.
- TIMEOUT /T 2 /NOBREAK >NUL
- echo Create a new user [1]
- echo Creation of user accounts by reading users names from a file [2]
- echo Modify an existing user [3]
- echo Exit [4]
- echo.
- echo.
- set /p page=1,2,3,4?
- if not defined page (goto main)
- if %page%==1 (goto new user)
- if %page%==3 (goto existing user)
- if %page%==2 (goto reading file)
- if %page%==4 (goto exit) else (goto void)
- echo.
- echo.
- pause>nul
- ::#############################################################
- :new user
- cls
- echo Creating a new user
- TIMEOUT /T 1 /NOBREAK >NUL
- echo.
- echo.
- set /p username= Please create your username (e.g.username123):
- echo.
- echo.
- echo Your username chosen is : %username%
- echo.
- set /p password= Please create your password (e.g. password123):
- echo.
- set /p passwordcom= Please retype to confirm your password:
- if %password% == %passwordcom% (net user %username% %password% /ADD /PASSWORDCHG:yes ) else (goto new user)
- pause>nul
- ::#############################################################
- :reading file
- cls
- echo Reading file
- echo.
- echo.
- set /p file=what file would you like to read?
- echo.
- echo The number of users in this text file:
- find /c /v "" < %file%.txt
- echo.
- echo list of users:
- echo.
- for /f "tokens=* delims= " %%a in (%file%.txt) do echo %%a
- echo.
- set /p multi=Would you like to create these into User Accounts (Y/N)?
- pause >nul
- ::#############################################################
- :existing user
- cls
- echo Modifying an existing user
- TIMEOUT /T 1 /NOBREAK >NUL
- echo.
- echo.
- echo Changing existing users password [1]
- echo Setting password to default [2]
- echo Deleting existing users [3]
- echo Viewing user accounts [4]
- echo Back to the main [5]
- echo.
- set /p page=1,2,3,4,5 ?
- if %page%==1 (goto changing password)
- if %page%==2 (goto Setting password to default)
- if %page%==3 (goto deleting)
- if %page%==4 (goto view user account)
- if %page%==5 (goto main) else (goto void)
- ::#############################################################
- :changing password
- cls
- echo Changing a password
- TIMEOUT /T 1 /NOBREAK >NUL
- echo.
- echo.
- echo Enter the username of the user account you would like to
- echo change the password of:
- echo.
- net user
- echo.
- set /p username=Enter existing username:
- set /p password=Enter new password:
- set /p passwordcom=Re enter new password:
- echo.
- set /p que= Are you sure (y/n)?
- if %que%==y (net user %username% %password%)
- if %que%==n (goto changing password)
- cls
- net user
- echo.
- echo User account "%username%" password has been changed.
- pause>nul
- goto main
- ::############################################################
- : Setting password to default
- echo Setting password to default
- echo.
- echo.
- echo Enter the username of the user account you would like to
- echo set password to default to:
- echo.
- net user
- echo.
- set /p username=Enter existing username:
- echo.
- set /p que= Are you sure (y/n)?
- if %que%==y (net user %username% password123)
- if %que%==n (goto existing user)
- cls
- net user
- echo.
- echo User account "%username%" password has been set to "password123".
- pause>nul
- goto main
- ::############################################################
- :deleting
- cls
- echo Deleting user
- TIMEOUT /T 1 /NOBREAK >NUL
- echo.
- echo.
- echo Here are the existing users:
- net user
- set /p deleting= Which user would you like to delete?
- set /p que= Are you sure (y/n)?
- if %que%==y (net user %deleting% /delete)
- if %que%==n (goto existing user)
- cls
- net user
- echo User account "%deleting%" has been deleted
- pause>nul
- goto main
- ::#############################################################
- :view user account
- cls
- echo Viewing user accounts
- TIMEOUT /T 1 /NOBREAK >NUL
- echo.
- echo.
- echo Here are the user accounts below:
- net user
- echo.
- echo.
- set /p view= Which user account would you like to view?
- echo.
- cls
- net user %view%
- pause>nul
- goto existing user
- ::#############################################################
- :exit
- cls
- echo Exit
- TIMEOUT /T 1 /NOBREAK >NUL
- echo.
- echo.
- set /p exit=Are you sure(y/n)?
- if %exit% ==y (goto quit)
- if %exit% ==n (goto main) else (goto void)
- exit
- pause>nul
- ::#############################################################
- :void
- echo.
- echo.
- color 0c
- echo Sorry that�s an invalid choice, please pick from the above.
- pause > nul
- (goto main)
- cls
- ::#############################################################
- :quit
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement