怎么用VB编写快速重启啊

来源:百度知道 编辑:UC知道 时间:2024/07/01 01:11:22
最好详细点 谢谢

Option Explicit
Dim str1 As Integer

Private Sub Command1_Click()
str1 = MsgBox("确定重启吗?", vbInformation + vbYesNo, "提示信息")
If str1 = 6 Then
Shell "shutdown -r -t 0"
Else
Exit Sub
End If
End Sub

Private Sub Form_Load()
Command1.Caption = "重启"
End Sub

最简单的:
新建个工程-新建窗体form1
双击form1,写下如下代码:
Private Sub Form_Load()
Shell "shutdown -r", vbNormalFocus
End Sub

“文件”-“生成工程1.exe” OK!
双击它就重启啦。

用shell 调用 shutdown -r -f -t0