實驗環境:windows7
打開記事本編寫腳本,完成後將文件存入C盤根目錄下test文件夾,格式爲bat
time /t>>c:\test\log.log
whoami >>c:\test\log.log
echo %username% >>c:\test\log.log
echo %computername% >>c:\test\log.log
按住菜單+R打開運行,輸入gpedit.Msc打開本地策略編輯器,選擇Windows設置———>腳本(啓動關機),添加腳本2.bat並確定。
重啓計算機,查看log.log文件