範例:
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.2
Author: 奔騰兔開發誌
Date : 2017/06/16
Script Function: Script Demo
Description :建立本機帳號並設定管理者群組中
Notes:http://pentiumto.blogspot.tw/
#ce ----------------------------------------------------------------------------
Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info
Opt("TrayIconHide", 0) ;0=show, 1=hide tray icon
Dim $sNowtime=@YEAR &"-"& @MON &"-"& @MDAY &" "& @HOUR &":"& @MIN
; ConsoleWrite($sNowtime & " [Info] " & @ScriptLineNumber & " 自訂訊息可以在開發過程除錯 "&@CRLF)
Dim $NewUser = "Admin" ;This is the User account to be created
Dim $Newpass = "Admin@password" ;This is were you enter the password you want for this account
Dim $Comment = "Windows Account Create Demo" ;This is a discription of the account that is added to the windows. Optional - leave blank for nothing to be entered
Dim $FName = "Admin" ;This is the Full name section of the account. Optional - leave blank for nothing to be entered
CreateUser()
Func CreateUser()
RunWait('net user '& $Newuser & ' ' & $Newpass & ' /add /fullname:"' & $FName & '" /comment:"' & $comment & '"', '', @SW_MAXIMIZE)
RunWait('net user '& $Newuser & ' /EXPIRES:never', '', @SW_HIDE)
RunWait('net localgroup users ' & $Newuser & ' /delete', '', @SW_HIDE)
RunWait('net localgroup Administrators ' & $Newuser & ' /add', '', @SW_HIDE)
RunWait('net accounts /maxpwage:unlimited', '', @SW_HIDE)
EndFunc
執行結果:
沒有留言:
張貼留言