RSS订阅优然探索
你的位置:首页 » 技术笔记 » 正文

Vb.net强制关闭计算机

选择字号: 超大 标准 发布时间:2008-9-11 9:57:6 | 作者:admin | 0个评论 | 人浏览

 Public Function DosCWindow(ByVal i As Integer) As String
        Dim S As String
        If i = 1 Then
            S = DosCommand("shutdown", "/f /l")
        ElseIf i = 2 Then
            S = DosCommand("shutdown", "/f /r")
        ElseIf i = 3 Then
            S = DosCommand("shutdown", "/f /s")
        End If
    End Function
    Private Function DosCommand(ByVal Str_Command As String, ByVal Str_Arguments As String) As String
        Dim Obj_Command As ProcessStartInfo = New ProcessStartInfo
        Dim Pro_Lob As Process = New Process
        Obj_Command.FileName = Str_Command
        Obj_Command.RedirectStandardInput = True
        Obj_Command.RedirectStandardOutput = True
        Obj_Command.RedirectStandardError = True
        Obj_Command.CreateNoWindow = True
        Obj_Command.UseShellExecute = False
        Obj_Command.Arguments = Str_Arguments
        Pro_Lob = Process.Start(Obj_Command)
        DosCommand = Pro_Lob.ToString
        Pro_Lob.Dispose()

    End Function

 

标签:

猜你喜欢

发表评论

必填

选填

选填

必填,不填不让过哦,嘻嘻。

记住我,下次回复时不用重新输入个人信息

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。