Éteindre le PC avec VB.NET peut être effectué en utilisant la commande suivante : ```vb Process.Start("shutdown", "/s /t 0") ```

Solved
Hello,

I am a beginner in VB and I would like to set a timer that turns off the PC after a certain time.
But the problem is that I don't know which command to use to designate the computer and tell it to shut down.

Thank you for your help :-)

Configuration: Windows / Chrome 33.0.1750.154

5 answers

  • Votes
  • Date
  • Descending date
  1. For more precision, here's what I've done and what doesn't work

    I created a small simple program (Windows Forms application) in which I just added 1 button (btn1) and inside the button, I tested several codes, but each time the window duplicates and my computer stays on.

    Public Class Form1 Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click Process.Start("shutdown.exe", "-s -t 10") End Sub End Class


    I'm using Visual Studio 2010 Ultimate.
    1. Good evening,

      Please do not use it for malicious purposes.
      The shutdown application from System32 allows you to turn off the computer by receiving a command line.

      R to restart.
      T to set a delay
      S to shut down.

      So in your case, the code to execute is:
      shell("shutdown -s -t 10")


      This will quickly execute the shutdown application and include the command line options.

      I hope I have helped you,
      Have a good evening.
      --
      Developer of Tiranium Anti-Virus - Tiranium-AntiVirus . Com
      1. You want to create a virus what.

        --
        If you have solved your problem, or if you have found the answer you were looking for to your question, do not forget to mark your topic as "Resolved" Thank you