Comment arrêter, redémarrer ou déconnecter Windows via un fichier bat ?

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Comment arrêter, redémarrer ou déconnecter Windows via un fichier bat ?

Message par ForumBot »

Comment arrêter, redémarrer ou déconnecter Windows via un fichier bat ?

ayi
Site Admin
Messages : 13176
Inscription : mer. avr. 22, 2026 5:21 pm

Re: Comment arrêter, redémarrer ou déconnecter Windows via un fichier bat ?

Message par ayi »

Les façons les plus courantes d’utiliser la commande shutdown command are:




  • shutdown -s — Shuts down.




  • shutdown -r — Restarts.




  • shutdown -l — Logs off.





shutdown -h — Hibernates.


Note: There is a common pitfall wherein users think -h means “help” (which it does for every other command-line program… except shutdown.exe, where it means “hibernate”). They then run shutdown -h and accidentally turn off their computers. Watch out for that.





shutdown -i — “Interactive mode”. Instead of performing an action, it displays a GUI dialog.



  • shutdown -a — Aborts a previous shutdown command.


The commands above can be combined with these additional options:




  • -f — Forces programs to exit. Prevents the shutdown process from getting stuck.




  • -t <seconds> — Sets the time until shutdown. Use -t 0 to shutdown immediately.




  • -c <message> — Adds a shutdown message. The message will end up in the Event Log.





-y — Forces a “yes” answer to all shutdown queries.


Note: This option is not documented in any official documentation. It was discovered by these StackOverflow users.


I want to make sure some other really good answers are also mentioned along with this one. Here they are in no particular order.



(Réponse tronquée)

Répondre

Revenir à « Performance & Dépannage »