{"id":941,"date":"2017-11-03T10:02:39","date_gmt":"2017-11-03T15:02:39","guid":{"rendered":"http:\/\/sites.williams.edu\/lj1\/?p=941"},"modified":"2017-11-03T10:02:39","modified_gmt":"2017-11-03T15:02:39","slug":"windows-10-check-for-service-status-and-restart-if-not-running","status":"publish","type":"post","link":"https:\/\/sites.williams.edu\/lj1\/labs\/windows-10-check-for-service-status-and-restart-if-not-running\/","title":{"rendered":"Windows 10 &#8211; Check for service status and restart if not running"},"content":{"rendered":"<p>from: <a href=\"https:\/\/stackoverflow.com\/questions\/3325081\/how-to-check-if-a-service-is-running-via-batch-file-and-start-it-if-it-is-not-r\">https:\/\/stackoverflow.com\/questions\/3325081\/how-to-check-if-a-service-is-running-via-batch-file-and-start-it-if-it-is-not-r<\/a><\/p>\n<blockquote><p>for \/F &#8220;tokens=3 delims=: &#8221; %%H in (&#8216;sc query &#8220;MyServiceName&#8221; ^| findstr &#8221;        STATE&#8221;&#8216;) do (<br \/>\n  if \/I &#8220;%%H&#8221; NEQ &#8220;RUNNING&#8221; (<br \/>\n   REM Put your code you want to execute here<br \/>\n   REM For example, the following line<br \/>\n   net start &#8220;MyServiceName&#8221;<br \/>\n  )<\/p>\n<p>)<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>from: https:\/\/stackoverflow.com\/questions\/3325081\/how-to-check-if-a-service-is-running-via-batch-file-and-start-it-if-it-is-not-r for \/F &#8220;tokens=3 delims=: &#8221; %%H in (&#8216;sc query &#8220;MyServiceName&#8221; ^| findstr &#8221; STATE&#8221;&#8216;) do ( if \/I &#8220;%%H&#8221; NEQ &#8220;RUNNING&#8221; ( REM Put your code you want to execute here REM For example, the following line net &hellip; <a class=\"more-link\" href=\"https:\/\/sites.williams.edu\/lj1\/labs\/windows-10-check-for-service-status-and-restart-if-not-running\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[10086],"tags":[73522],"class_list":["post-941","post","type-post","status-publish","format-standard","hentry","category-labs","tag-windows-10"],"acf":[],"_links":{"self":[{"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/posts\/941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/comments?post=941"}],"version-history":[{"count":1,"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/posts\/941\/revisions"}],"predecessor-version":[{"id":942,"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/posts\/941\/revisions\/942"}],"wp:attachment":[{"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/media?parent=941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/categories?post=941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.williams.edu\/lj1\/wp-json\/wp\/v2\/tags?post=941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}