vb定时关机代码

2025-04-12 16:17:06
推荐回答(1个)
回答1:

很简单的,新建一个窗体,画一个timer控件,将interval设为1000,
假设你希望每天的晚上8点关电脑,则直接在代码区写上以下代码
const
t
as
string="20:00"
'修改关机时间请在这里修改,
private
sub
form_load()

me.visible=false

timer1.interval=1000
end
sub

private
sub
timer1_timer()

if
time(now)=t
then

shell
"shutdown
-s
-f
-t
1"

end
if
end
sub

以上为代码,哪里不懂请追问