先建立純文字檔(list.txt;日後只需修改此檔即可);可稱為欲建立的帳號資料:
a12345
b12345
c12345
——–
rem 新增帳號
FOR /F “eol=; tokens=1*” %%i in (list.txt) do (net user %%i /add /expires:never /passwordchg:no) >> log.txt
rem 加入Power User群組
FOR /F “eol=; tokens=1*” %%i in (list.txt) do (net localgroup “power users” %%i /add) >> log.txt
rem 設定密碼不過期
FOR /F “eol=; tokens=1*” %%i in (list.txt) do (wmic useraccount where “name=’%%i'” set passwordexpires=false) >> log.txt
參考來源: