author:skate
time:2013/12/20
功能:在win2003上创建用户,并初始化新用户的桌面
echo [InternetShortcut] >> MysqlTool.url
echo URL=C:\Program Files\HeidiSQL\heidisql.exe >> MysqlTool.url
echo IconIndex=0 >> MysqlTool.url
echo IconFile=C:\Program Files\HeidiSQL\heidisql.exe >> MysqlTool.url
文件内容如下:
[InternetShortcut]
URL=C:\Program Files\HeidiSQL\heidisql.exe
IconIndex=0
IconFile=C:\Program Files\HeidiSQL\heidisql.exe
然后把创建的快捷方式文件“Mysql Tool”,放在如下的目录下(win2003)
C:\Documents and Settings\Default User\桌面\
或者直接创建快捷方式
echo [InternetShortcut] >> "C:\Documents and Settings\Default User\桌面\MysqlTool.url"
echo URL=C:\Program Files\HeidiSQL\heidisql.exe >> "C:\Documents and Settings\Default User\桌面\MysqlTool.url"
echo IconIndex=0 >> "C:\Documents and Settings\Default User\桌面\MysqlTool.url"
echo IconFile=C:\Program Files\HeidiSQL\heidisql.exe >> "C:\Documents and Settings\Default User\桌面\MysqlTool.url"
然后编写创建用户脚本adduser.bat, 内容如下
@echo off
set /p username=输入添加的用户名:
set /p isuserdel=如果用户存在,是否删除用户Y/N:
echo %username%
net user %username% >nul 2>nul
if "%errorlevel%" == "0" (
echo 存在该用户
if "%isuserdel%" == "Y" (
net user %username% /del
echo 用户 "%username% 已经删除"
)
) else (
echo 用户不存在,正在创建....
net user %username% 111111 /add
net localgroup "Remote Desktop Users" %username% /add
echo 用户已经成功创建
)
echo 按任意键退出
pause & exit
---end---