{"id":138491,"date":"2020-02-04T19:47:00","date_gmt":"2020-02-04T18:47:00","guid":{"rendered":"https:\/\/basic-tutorials.de\/?p=138491"},"modified":"2020-02-05T12:34:01","modified_gmt":"2020-02-05T11:34:01","slug":"windows-tutorial-shutdown-timer-mit-zeitangabe","status":"publish","type":"post","link":"https:\/\/basic-tutorials.de\/ratgeber\/software\/windows-tutorial-shutdown-timer-mit-zeitangabe\/","title":{"rendered":"Windows-Tutorial: Shutdown-Timer mit Zeitangabe"},"content":{"rendered":"<p>Um seinen Rechner automatisch nach einer bestimmten Zeit herunterzufahren gibt es das ein oder andere Tool. Eine schlankere L\u00f6sung ist wohl eine einfache Batch-Datei mit einem Shutdown-Befehl. Wir schreiben uns also eine Batch-Datei mit einem Shutdown inklusive Eingabe der Minuten, wie lange es dauern soll, bis der PC herunterf\u00e4hrt. K\u00fcmmern wir uns also direkt um die Datei.<\/p>\n<h2>Textdokument erstellen und f\u00fcllen<\/h2>\n<p>Zuerst brauchen wir ein neues Textdokument. In dieses Textdokument schreibt ihr die unten stehende Befehle. Mit <strong>@echo off<\/strong> lassen wir alle Befehle in der sp\u00e4teren Ausgabe ausblenden. Mit\u00a0<strong>echo\u00a0<\/strong>lassen wir unsere erste Frage mit der entsprechenden Eingabe in der Kommandozeile auftauchen. Der erste\u00a0<strong>set-Befehl<\/strong> ist unsere Eingabe der Minuten, der darauffolgende multipliziert unsere Eingabe mit 60, da im Batch nur Sekundenangaben akzeptiert werden. Das letzte <strong>echo\u00a0<\/strong>gibt dann nochmal unsere Eingabe aus.<\/p>\n<div id='gallery-1' class='gallery galleryid-138491 gallery-columns-3 gallery-size-thumbnail'><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-6.png'><img loading=\"lazy\" decoding=\"async\" width=\"220\" height=\"162\" src=\"https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-6-220x162.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-1-138520\" srcset=\"https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-6-220x162.png 220w, https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-6-390x288.png 390w, https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-6.png 591w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/a>\n\t\t\t<\/div>\n\t\t\t\t<figcaption class='wp-caption-text gallery-caption' id='gallery-1-138520'>\n\t\t\t\tNeues Textdokument erstellen und mit Inhalt f\u00fcllen.\n\t\t\t\t<\/figcaption><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-5.png'><img loading=\"lazy\" decoding=\"async\" width=\"220\" height=\"192\" src=\"https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-5-220x192.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-1-138519\" srcset=\"https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-5-220x192.png 220w, https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-5.png 278w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/a>\n\t\t\t<\/div>\n\t\t\t\t<figcaption class='wp-caption-text gallery-caption' id='gallery-1-138519'>\n\t\t\t\tDanach &#8222;Speicher unter&#8230;&#8220;\n\t\t\t\t<\/figcaption><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-4.png'><img loading=\"lazy\" decoding=\"async\" width=\"220\" height=\"120\" src=\"https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-4-220x120.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-1-138518\" srcset=\"https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-4-220x120.png 220w, https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-4-390x213.png 390w, https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-4-780x427.png 780w, https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-4.png 1161w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/a>\n\t\t\t<\/div>\n\t\t\t\t<figcaption class='wp-caption-text gallery-caption' id='gallery-1-138518'>\n\t\t\t\t&#8230;und als Batch-File speichern.\n\t\t\t\t<\/figcaption><\/figure>\n\t\t<\/div>\n\n<p>Durch\u00a0<strong>pause<\/strong> ist nochmal eine Taste zu dr\u00fccken, bevor dann endg\u00fcltig der Shutdown ausgef\u00fchrt wird.<\/p>\n<pre>@echo off\r\necho In wie vielen Minuten soll der Computer herunterfahren?\r\nset \/p min=Zeit in Minuten:\r\nset \/a zeit=%min%*60\r\necho Der Computer f\u00e4hrt in %min% Minuten herunter.\r\npause\r\nshutdown -s -t %zeit% -f<\/pre>\n<p>Nun die Datei \u00fcber\u00a0<strong>Speicher unter\u00a0<\/strong>als .bat speichern. Hierf\u00fcr setzt ihr den Dateityp auf <strong>Alle Dateien<\/strong> und gebt bei Dateinamen beispielsweise shutdown-timer.bat ein &#8211; am wichtigsten ist die Endung!<\/p><div class=\"losgehts-inhalt losgehts-entity-placement\" style=\"text-align: center;\" id=\"losgehts-482906637\"><div class=\"losgehts-adlabel\">Anzeige<\/div><script type=\"text\/plain\" data-tcf=\"waiting-for-consent\" data-id=\"405718\" data-bid=\"1\">PGRpdiBpZD0ibG9zZ2VodHMtMTI0NTEwNzcwNyIgY2xhc3M9Imdhc19mYWxsYmFjay1hZF80MDU3MTgtLXBsYWNlbWVudF8zNDgzODMiPjxzY3JpcHQgYXN5bmMgc3JjPSIvL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL3BhZ2VhZC9qcy9hZHNieWdvb2dsZS5qcz9jbGllbnQ9Y2EtcHViLTgxNDg3Njg4MjM4MDczMzAiIGNyb3Nzb3JpZ2luPSJhbm9ueW1vdXMiPjwvc2NyaXB0PjxpbnMgY2xhc3M9ImFkc2J5Z29vZ2xlIiBzdHlsZT0iZGlzcGxheTpibG9jazsiIGRhdGEtYWQtY2xpZW50PSJjYS1wdWItODE0ODc2ODgyMzgwNzMzMCIgCmRhdGEtYWQtc2xvdD0iODY0MTc4NTI2NSIgCmRhdGEtYWQtZm9ybWF0PSJhdXRvIj48L2lucz4KPHNjcmlwdD4gCihhZHNieWdvb2dsZSA9IHdpbmRvdy5hZHNieWdvb2dsZSB8fCBbXSkucHVzaCh7fSk7IAo8L3NjcmlwdD4KPC9kaXY+<\/script><\/div>\n<h2>Wie kann ich den Shutdown-Timer abbrechen?<\/h2>\n<p>Nun kann es nat\u00fcrlich vorkommen, dass man den Shutdown-Timer abbrechen m\u00f6chte. Daf\u00fcr m\u00fcssen wir unseren Code etwas erweitern und auch um den wichtigen\u00a0<strong>exit-Befehl<\/strong> erweitern.<\/p>\n<p>Zuerst teilen wir den Code wie folgt auf:<\/p>\n<pre>@echo off\r\necho In wie vielen Minuten soll der Computer herunterfahren?\r\nset \/p min=Zeit in Minuten:\r\nif %min% == a (\r\ngoto cancel\r\n)\r\n<\/pre>\n<p>Die\u00a0<strong>if-Schleife<\/strong> schaut jetzt, ob ihr etwas anderes als eine Zeit eingebt. Hier k\u00f6nnt ihr statt dem\u00a0<strong>a\u00a0<\/strong>auch ein Wort eingeben. Ihr m\u00fcsst es dann aber exakt SO eingeben! Deswegen w\u00e4hlen wir einfach das kleine\u00a0<strong>a\u00a0<\/strong>f\u00fcr abort, abbrechen oder was anderes. \u00dcber\u00a0<strong>goto cancel<\/strong> rufen wir die Funktion f\u00fcr das Abbrechen auf.<\/p>\n<pre>set \/a zeit=%min%*60\r\necho Der Computer f\u00e4hrt in %min% Minuten herunter.\r\npause\r\nshutdown -s -t %zeit% -f\r\nexit\r\n:cancel\r\necho.\r\necho Timer abbrechen?\r\npause\r\nshutdown -a<\/pre>\n<p>Dann folgt unser bisher bekannte Teil. Hinter dem\u00a0<strong>shutdown<\/strong> folgt jetzt aber noch ein\u00a0<strong>exit<\/strong>. So wird unser Programm auch beendet und hebt sich nicht durch die nachfolgenden Zeilen wieder auf. Um die Funktion zu starten, gehen wir \u00fcber\u00a0<strong>:cancel<\/strong>, geben noch einmal eine Frage aus und warten dann auf einen Tastendruck mit\u00a0<strong>pause<\/strong>. Um den Timer abzubrechen, nutzen wir wieder\u00a0<strong>shutdown<\/strong> mit dem Parameter &#8211;<strong>a<\/strong>.<\/p><div class=\"losgehts-inhalt losgehts-entity-placement\" style=\"text-align: center;\" id=\"losgehts-3767432597\"><div class=\"losgehts-adlabel\">Anzeige<\/div><script type=\"text\/plain\" data-tcf=\"waiting-for-consent\" data-id=\"405718\" data-bid=\"1\">PGRpdiBpZD0ibG9zZ2VodHMtMzc3ODU4MTIyMiIgY2xhc3M9Imdhc19mYWxsYmFjay1hZF80MDU3MTgtLXBsYWNlbWVudF8zNDgzODMiPjxzY3JpcHQgYXN5bmMgc3JjPSIvL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL3BhZ2VhZC9qcy9hZHNieWdvb2dsZS5qcz9jbGllbnQ9Y2EtcHViLTgxNDg3Njg4MjM4MDczMzAiIGNyb3Nzb3JpZ2luPSJhbm9ueW1vdXMiPjwvc2NyaXB0PjxpbnMgY2xhc3M9ImFkc2J5Z29vZ2xlIiBzdHlsZT0iZGlzcGxheTpibG9jazsiIGRhdGEtYWQtY2xpZW50PSJjYS1wdWItODE0ODc2ODgyMzgwNzMzMCIgCmRhdGEtYWQtc2xvdD0iODY0MTc4NTI2NSIgCmRhdGEtYWQtZm9ybWF0PSJhdXRvIj48L2lucz4KPHNjcmlwdD4gCihhZHNieWdvb2dsZSA9IHdpbmRvdy5hZHNieWdvb2dsZSB8fCBbXSkucHVzaCh7fSk7IAo8L3NjcmlwdD4KPC9kaXY+<\/script><\/div>\n<div id='gallery-2' class='gallery galleryid-138491 gallery-columns-2 gallery-size-large'><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-1.png'><img loading=\"lazy\" decoding=\"async\" width=\"780\" height=\"408\" src=\"https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-1-780x408.png\" class=\"attachment-large size-large\" alt=\"\" srcset=\"https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-1-780x408.png 780w, https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-1-390x204.png 390w, https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-1-220x115.png 220w, https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-1.png 979w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-3.png'><img loading=\"lazy\" decoding=\"async\" width=\"780\" height=\"408\" src=\"https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-3-780x408.png\" class=\"attachment-large size-large\" alt=\"\" srcset=\"https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-3-780x408.png 780w, https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-3-390x204.png 390w, https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-3-220x115.png 220w, https:\/\/basic-tutorials.de\/wp-content\/uploads\/2020\/01\/shutdown-timer-3.png 979w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/><\/a>\n\t\t\t<\/div><\/figure>\n\t\t<\/div>\n\n<p>Nun habt ihr euren eigenen Shutdown-Timer mit Zeiteingabe. Falls gew\u00fcnscht kann das Programm noch erweitert werden, beispielsweise mit einer Abfrage, ob die eingegebene Zeit unter 0 ist oder tats\u00e4chlich Zahlen eingegeben wurden. Im Anschluss findet ihr noch den gesamten Code f\u00fcr den Timer.<\/p>\n<pre>@echo off\r\necho In wie vielen Minuten soll der Computer herunterfahren?\r\nset \/p min=Zeit in Minuten:\r\nif %min% == a (\r\ngoto cancel\r\n)\r\nset \/a zeit=%min%*60\r\necho Der Computer f\u00e4hrt in %min% Minuten herunter.\r\npause\r\nshutdown -s -t %zeit% -f\r\nexit\r\n:cancel\r\necho.\r\necho Timer abbrechen?\r\npause\r\nshutdown -a<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Um seinen Rechner automatisch nach einer bestimmten Zeit herunterzufahren gibt es das ein oder andere Tool. Eine schlankere L\u00f6sung ist wohl eine einfache Batch-Datei mit einem Shutdown-Befehl. Wir schreiben uns also eine Batch-Datei mit einem Shutdown inklusive Eingabe der Minuten, wie lange es dauern soll, bis der PC herunterf\u00e4hrt. K\u00fcmmern wir uns also direkt um &#8230; <a title=\"Windows-Tutorial: Shutdown-Timer mit Zeitangabe\" class=\"read-more\" href=\"https:\/\/basic-tutorials.de\/ratgeber\/software\/windows-tutorial-shutdown-timer-mit-zeitangabe\/\" aria-label=\"Mehr Informationen \u00fcber Windows-Tutorial: Shutdown-Timer mit Zeitangabe\">Weiterlesen &#8230;<\/a><\/p>\n","protected":false},"author":8,"featured_media":138515,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[85444],"tags":[10,897],"class_list":["post-138491","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-windows","tag-windows-10","infinite-scroll-item"],"acf":[],"lang":"de","translations":{"de":138491},"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/basic-tutorials.de\/wp-json\/wp\/v2\/posts\/138491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/basic-tutorials.de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/basic-tutorials.de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/basic-tutorials.de\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/basic-tutorials.de\/wp-json\/wp\/v2\/comments?post=138491"}],"version-history":[{"count":0,"href":"https:\/\/basic-tutorials.de\/wp-json\/wp\/v2\/posts\/138491\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/basic-tutorials.de\/wp-json\/wp\/v2\/media\/138515"}],"wp:attachment":[{"href":"https:\/\/basic-tutorials.de\/wp-json\/wp\/v2\/media?parent=138491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/basic-tutorials.de\/wp-json\/wp\/v2\/categories?post=138491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/basic-tutorials.de\/wp-json\/wp\/v2\/tags?post=138491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}