vbs实现windows通过文本导入批量增加用户

来源:互联网 发布:淘宝卖家有客户端吗 编辑:程序博客网 时间:2024/05/08 00:38

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


0 0