Éteindre le PC avec VB.NET peut être effectué en utilisant la commande suivante : ```vb Process.Start("shutdown", "/s /t 0") ```
Solved
Anonymous user
-
Anonymous user -
Anonymous user -
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
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
-
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. -
-
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 -
Bonjour, voici la traduction demandée :
shell("shutdown -s -t 10")
just duplicates the main window but does not cause the computer to shut down.
the command that works under vb.net Windows Form is:
Process.Start("C:\Windows\System32\shutdown.exe", "-s -t 10")
thanks to labtec__007 for this answer
source https://openclassrooms.com/forum/sujet/vb-net-commande-shutdown-ne-fonctionnant-pas-62797#message-85510656 -
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