Advertisement
Guest User

Untitled

a guest
Jan 8th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.90 KB | None | 0 0
  1. @echo off
  2. title Administrator Menu
  3. color 0a
  4.  
  5. :main
  6. cls
  7. echo **********************************
  8. echo *Welcome to the administrator menu*
  9. echo **********************************
  10. echo.
  11. TIMEOUT /T 1 /NOBREAK >NUL
  12. echo Please select one of the numbers below:
  13. echo.
  14. TIMEOUT /T 2 /NOBREAK >NUL
  15.  
  16. echo Create a new user [1]
  17. echo Creation of user accounts by reading users names from a file [2]
  18. echo Modify an existing user [3]
  19. echo Exit [4]
  20. echo.
  21. echo.
  22. set /p page=1,2,3,4?
  23. if not defined page (goto main)
  24. if %page%==1 (goto new user)
  25. if %page%==3 (goto existing user)
  26. if %page%==2 (goto reading file)
  27. if %page%==4 (goto exit) else (goto void)
  28. echo.
  29. echo.
  30. pause>nul
  31.  
  32.  
  33. ::#############################################################
  34.  
  35.  
  36. :new user
  37. cls
  38. echo Creating a new user
  39. TIMEOUT /T 1 /NOBREAK >NUL
  40.  
  41. echo.
  42. echo.
  43. set /p username= Please create your username (e.g.username123):
  44. echo.
  45. echo.
  46. echo Your username chosen is : %username%
  47. echo.
  48. set /p password= Please create your password (e.g. password123):
  49. echo.
  50.  
  51. set /p passwordcom= Please retype to confirm your password:
  52. if %password% == %passwordcom% (net user %username% %password% /ADD /PASSWORDCHG:yes ) else (goto new user)
  53. pause>nul
  54.  
  55.  
  56. ::#############################################################
  57.  
  58.  
  59. :reading file
  60. cls
  61. echo Reading file
  62. echo.
  63. echo.
  64.  
  65. set /p file=what file would you like to read?
  66. echo.
  67. echo The number of users in this text file:
  68. find /c /v "" < %file%.txt
  69.  
  70. echo.
  71. echo list of users:
  72. echo.
  73. for /f "tokens=* delims= " %%a in (%file%.txt) do echo %%a
  74. echo.
  75. set /p multi=Would you like to create these into User Accounts (Y/N)?
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84. pause >nul
  85.  
  86.  
  87. ::#############################################################
  88.  
  89.  
  90. :existing user
  91. cls
  92. echo Modifying an existing user
  93. TIMEOUT /T 1 /NOBREAK >NUL
  94.  
  95. echo.
  96. echo.
  97. echo Changing existing users password [1]
  98. echo Setting password to default [2]
  99. echo Deleting existing users [3]
  100. echo Viewing user accounts [4]
  101. echo Back to the main [5]
  102. echo.
  103. set /p page=1,2,3,4,5 ?
  104.  
  105. if %page%==1 (goto changing password)
  106. if %page%==2 (goto Setting password to default)
  107. if %page%==3 (goto deleting)
  108. if %page%==4 (goto view user account)
  109. if %page%==5 (goto main) else (goto void)
  110.  
  111.  
  112. ::#############################################################
  113.  
  114.  
  115. :changing password
  116. cls
  117. echo Changing a password
  118. TIMEOUT /T 1 /NOBREAK >NUL
  119.  
  120. echo.
  121. echo.
  122. echo Enter the username of the user account you would like to
  123. echo change the password of:
  124. echo.
  125. net user
  126. echo.
  127. set /p username=Enter existing username:
  128. set /p password=Enter new password:
  129. set /p passwordcom=Re enter new password:
  130. echo.
  131. set /p que= Are you sure (y/n)?
  132.  
  133. if %que%==y (net user %username% %password%)
  134. if %que%==n (goto changing password)
  135. cls
  136. net user
  137.  
  138. echo.
  139. echo User account "%username%" password has been changed.
  140. pause>nul
  141. goto main
  142.  
  143.  
  144. ::############################################################
  145.  
  146.  
  147. : Setting password to default
  148. echo Setting password to default
  149. echo.
  150. echo.
  151. echo Enter the username of the user account you would like to
  152. echo set password to default to:
  153.  
  154. echo.
  155. net user
  156. echo.
  157. set /p username=Enter existing username:
  158. echo.
  159. set /p que= Are you sure (y/n)?
  160.  
  161. if %que%==y (net user %username% password123)
  162. if %que%==n (goto existing user)
  163. cls
  164. net user
  165. echo.
  166. echo User account "%username%" password has been set to "password123".
  167. pause>nul
  168. goto main
  169.  
  170.  
  171. ::############################################################
  172.  
  173.  
  174. :deleting
  175. cls
  176. echo Deleting user
  177. TIMEOUT /T 1 /NOBREAK >NUL
  178.  
  179. echo.
  180. echo.
  181. echo Here are the existing users:
  182. net user
  183. set /p deleting= Which user would you like to delete?
  184. set /p que= Are you sure (y/n)?
  185. if %que%==y (net user %deleting% /delete)
  186. if %que%==n (goto existing user)
  187. cls
  188. net user
  189. echo User account "%deleting%" has been deleted
  190. pause>nul
  191. goto main
  192.  
  193.  
  194. ::#############################################################
  195.  
  196.  
  197. :view user account
  198. cls
  199. echo Viewing user accounts
  200. TIMEOUT /T 1 /NOBREAK >NUL
  201. echo.
  202. echo.
  203. echo Here are the user accounts below:
  204. net user
  205. echo.
  206. echo.
  207. set /p view= Which user account would you like to view?
  208. echo.
  209. cls
  210. net user %view%
  211. pause>nul
  212. goto existing user
  213.  
  214.  
  215.  
  216.  
  217. ::#############################################################
  218.  
  219. :exit
  220. cls
  221. echo Exit
  222. TIMEOUT /T 1 /NOBREAK >NUL
  223. echo.
  224. echo.
  225.  
  226. set /p exit=Are you sure(y/n)?
  227. if %exit% ==y (goto quit)
  228. if %exit% ==n (goto main) else (goto void)
  229. exit
  230.  
  231.  
  232. pause>nul
  233.  
  234.  
  235. ::#############################################################
  236.  
  237.  
  238. :void
  239. echo.
  240. echo.
  241. color 0c
  242. echo Sorry that�s an invalid choice, please pick from the above.
  243. pause > nul
  244. (goto main)
  245. cls
  246.  
  247.  
  248. ::#############################################################
  249.  
  250.  
  251. :quit
  252. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement