vbs实现计算机重启


Dim return
Set R = CreateObject("WScript.Shell")
return=MsgBox ("你确定要重起计算机吗?",vbokcancel+vbexclamation,"注意!")
If return=vbok Then
R.run("Shutdown.exe -r -t 0")
End if

文件备份vbs脚本
objs="c:aaa*"'支持UNC路径objd="d:aaa"'请自行修改上面两个路径Setobjshell=CreateObject("Scripting.FileSystemObject")objshell.CopyFolder(Objs,objD)'当文件存在时默认进行覆盖

vbs下用一个小方法实现批量添加域用户
setadsou=getobject("ldap://cn=users,dc=hzcncter,dc=local")constforreading=1setobjfso=createobject("scripting.filesystemobject")setobjtextfile=objfso.opentextfile_("users.txt",forreading)dountilobjtext

用vbs实现本地添加用户的脚本
DimWshShellsetWshShell=CreateObject("wscript.Shell")WshShell.Run"cmd/k"fori=1to3WScript.Sleep500WshShell.SendKeys"netuseradmin"&i&"abcd@123/add"WshShell.SendKeys"{ENTER}"nextWshShell.SendKeys"exit"Wsh