借助VBS,可以批量向windows添加帐户,代码如下:
①adduser.vbs文件的代码
dim os,cmd,myfile,myarray
Set WshShell = CreateObject("Wscript.Shell")
set fso=createobject("scripting.filesystemobject")
set userFile=fso.opentextfile("用户帐号及密码.txt",1)
do while Not userfile.atendofstream
readlinetextfile=userfile.readline
wscript.echo readlinetextfile
myarray=split(readlinetextfile,",",-1,1)
user=myarray(0)
password=myarray(1)
cmd="cmd /c net user "&user&" "&password&" /add /active:yes /expires:never /passwordchg:no"
wscript.echo cmd
WshShell.run cmd,0,false
loop
②使用应注意
用户账号及密码.txt (注:必须与上面的vbs文件放在一个文件夹内,即路径及位置要相同)
test1,password
test2,password