ayi <p>Comment arrêter, redémarrer ou déconnecter Windows via un fichier bat ?</p> <hr> <p><em>Source : <a href="https://ss64.com/nt/shutdown.html" rel="noopener nofollow ugc">Stack Overflow [windows]</a></em></p>
ayi_2 <p>Les façons les plus courantes d’utiliser la commande <a href="https://ss64.com/nt/shutdown.html"><code>shutdown</code></a> command are:</p> <ul> <li> <p><code>shutdown -s</code> — Shuts down.</p> </li> <li> <p><code>shutdown -r</code> — Restarts.</p> </li> <li> <p><code>shutdown -l</code> — Logs off.</p> </li> <li></li> </ul> <p><code>shutdown -h</code> — Hibernates.</p> <p><strong>Note:</strong> There is a common pitfall wherein users think <code>-h</code> means “help” (which it does for every other command-line program… except <code>shutdown.exe</code>, where it means “hibernate”). They then run <code>shutdown -h</code> and accidentally turn off their computers. Watch out for that.</p> <ul> <li></li> </ul> <p><code>shutdown -i</code> — “Interactive mode”. Instead of performing an action, it displays a GUI dialog.</p> <ul> <li><code>shutdown -a</code> — Aborts a previous shutdown command.</li> </ul> <p>The commands above can be combined with these additional options:</p> <ul> <li> <p><code>-f</code> — Forces programs to exit. Prevents the shutdown process from getting stuck.</p> </li> <li> <p><code>-t <seconds></code> — Sets the time until shutdown. Use <code>-t 0</code> to shutdown immediately.</p> </li> <li> <p><code>-c <message></code> — Adds a shutdown message. The message will end up in the Event Log.</p> </li> <li></li> </ul> <p><code>-y</code> — Forces a “yes” answer to all shutdown queries.</p> <p><strong>Note:</strong> This option is not documented in any official documentation. It was discovered by <a href="https://stackoverflow.com/questions/46071009/what-exactly-does-shutdown-y-do">these StackOverflow users</a>.</p> <p>I want to make sure some other really good answers are also mentioned along with this one. Here they are in no particular order.</p> <ul> <li> <p><a href="https://stackoverflow.com/questions/162304/how-do-i-shutdown-restart-logoff-via-bat-file#162342">The <code>-f</code> option</a> from <a href="https://stackoverflow.com/users/672/kogus">JosephStyons</a></p> </li> <li> <p><a href="https://stackoverflow.com/questions/162304/how-do-i-shutdown-restart-logoff-via-bat-file#162398">Using <code>rundll32</code></a> from <a href="https://stackoverflow.com/users/6309/vonc">VonC</a></p> </li> <li> <p><a href="https://stackoverflow.com/questions/162304/how-do-i-shutdown-restart-logoff-via-bat-file#162428">The Run box</a> from <a href="https://stackoverflow.com/users/14966/dean">Dean</a></p> </li> <li> <p>[Remote shutdown](<a href="https://stackoverflow.com/questions/162304/how-do-i-shutdown-restart-logoff-windows-via-bat-file#41">https://stackoverflow.com/questions/162304/how-do-i-shutdown-restart-logoff-windows-via-bat-file#41</a></p> </li> </ul> <p><em>(Réponse tronquée)</em></p>