一个apache的网站,添加删除用户修改密码都需要输入命令,使用批处理简化操作,排除不必要的人为因素。
::**********************
::*** 权限操作批处理
::版本:0.1
::admin
::**********************
@echo off
:begin
@set /p class=请输入要进行的操作 a(创建新用户),b(修改密码),c(删除用户):
if "%class%" == "a" goto create
if "%class%" == "b" goto update
if "%class%" == "c" goto delete
::*******************************
:create
@set /p number=请输入需创建用户的类别编号1(everyone),2(RD),3(sales),4(sales-c),5(commodity-c),6(topmanagement):
@set /p name=请输入要创建的用户名:
@echo 新用户类别别是:%number%;用户名为:%name%
if "%number%" == "1" goto everyone
if "%number%" == "2" goto rd
if "%number%" == "3" goto sales
if "%number%" == "4" goto sales-c
if "%number%" == "5" goto commodity-c
if "%number%" == "6" goto top
:update
@set /p number=请输入需修改密码用户的类别编号1(everyone),2(RD),3(sales),4(sales-c),5(commodity-c),6(topmanagement):
@set /p name=请输入要修改密码的用户名:
@echo 新用户类别别是:%number%;用户名为:%name%
if "%number%" == "1" goto everyone-u
if "%number%" == "2" goto rd-u
if "%number%" == "3" goto sales-u
if "%number%" == "4" goto sales-c-u
if "%number%" == "5" goto commodity-c-u
if "%number%" == "6" goto top-u
:delete
@set /p number=请输入需删除用户的类别编号1(everyone),2(RD),3(sales),4(sales-c),5(commodity-c),6(topmanagement):
@set /p name=请输入要删除的用户名:
@echo 新用户类别别是:%number%;用户名为:%name%
if "%number%" == "1" goto everyone-d
if "%number%" == "2" goto rd-d
if "%number%" == "3" goto sales-d
if "%number%" == "4" goto sales-c-d
if "%number%" == "5" goto commodity-c-d
if "%number%" == "6" goto top-d
::************************create new user******************************
:everyone
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Everyone\htuser.passwd %name%
echo 用户%name%创建成功!
pause
goto exit
:rd
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\RD\rduser.passwd %name%
echo 用户%name%创建成功!
pause
goto exit
:sales
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Sales\salesuser.passwd %name%
echo 用户%name%创建成功!
pause
goto exit
:sales-c
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Sales-C\scuser.passwd %name%
echo 用户%name%创建成功!
pause
goto exit
:commodity-c
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Commodity-C\htuser.passwd %name%
echo 用户%name%创建成功!
pause
goto exit
:top
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Everyone\htuser.passwd %name%
echo everyone创建成功!
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\RD\rduser.passwd %name%
echo RD创建成功!
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Sales\salesuser.passwd %name%
echo Sales创建成功!
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Sales-C\scuser.passwd %name%
echo Sales-C创建成功!
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Commodity-C\htuser.passwd %name%
echo Commodity-C创建成功!
echo 用户%name%全部创建成功!
pause
goto exit
::****************update password**********************************
:everyone-u
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Everyone\htuser.passwd %name%
echo 用户%name%密码修改成功!
pause
goto exit
:rd-u
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\RD\rduser.passwd %name%
echo 用户%name%密码修改成功!
pause
goto exit
:sales-u
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Sales\salesuser.passwd %name%
echo 用户%name%密码修改成功!
pause
goto exit
:sales-c-u
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Sales-C\scuser.passwd %name%
echo 用户%name%密码修改成功!
pause
goto exit
:commodity-c-u
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Commodity-C\htuser.passwd %name%
echo 用户%name%密码修改成功!
pause
goto exit
:top-u
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Everyone\htuser.passwd %name%
echo everyone密码修改成功!
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\RD\rduser.passwd %name%
echo RD密码修改成功!
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Sales\salesuser.passwd %name%
echo Sales密码修改成功!
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Sales-C\scuser.passwd %name%
echo Sales-C密码修改成功!
C:\xampp\apache\bin\htpasswd.exe D:\USERDATAS\Commodity-C\htuser.passwd %name%
echo Commodity-C密码修改成功!
echo 用户%name%密码全部修改成功!
pause
goto exit
::***************************delete user**********************************
:everyone-d
C:\xampp\apache\bin\htpasswd.exe -D D:\USERDATAS\Everyone\htuser.passwd %name%
echo 用户%name%删除成功!
pause
goto exit
:rd-d
C:\xampp\apache\bin\htpasswd.exe -D D:\USERDATAS\RD\rduser.passwd %name%
echo 用户%name%删除成功!
pause
goto exit
:sales-d
C:\xampp\apache\bin\htpasswd.exe -D D:\USERDATAS\Sales\salesuser.passwd %name%
echo 用户%name%删除成功!
pause
goto exit
:sales-c-d
C:\xampp\apache\bin\htpasswd.exe -D D:\USERDATAS\Sales-C\scuser.passwd %name%
echo 用户%name%删除成功!
pause
goto exit
:commodity-c-d
C:\xampp\apache\bin\htpasswd.exe -D D:\USERDATAS\Commodity-C\htuser.passwd %name%
echo 用户%name%删除成功!
pause
goto exit
:top-d
C:\xampp\apache\bin\htpasswd.exe -D D:\USERDATAS\Everyone\htuser.passwd %name%
echo everyone删除成功!
C:\xampp\apache\bin\htpasswd.exe -D D:\USERDATAS\RD\rduser.passwd %name%
echo RD删除成功!
C:\xampp\apache\bin\htpasswd.exe -D D:\USERDATAS\Sales\salesuser.passwd %name%
echo Sales删除成功!
C:\xampp\apache\bin\htpasswd.exe -D D:\USERDATAS\Sales-C\scuser.passwd %name%
echo Sales-C删除成功!
C:\xampp\apache\bin\htpasswd.exe -D D:\USERDATAS\Commodity-C\htuser.passwd %name%
echo Commodity-C删除成功!
echo 用户%name%全部删除成功!
pause
goto exit
::***************************exit or contuine******************************
:exit
@set /p e=继续请按1,退出请按2:
if "%e%" == "1" goto begin
if "%e%" == "2" exit