<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; CMD/BAT: Создание батника с проверкой службы]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17221&amp;type=atom" />
	<updated>2022-07-05T19:52:52Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=17221</id>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Создание батника с проверкой службы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153793#p153793" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>andypetr пишет:</cite><blockquote><p><strong>henry.ford.2018</strong>, нужно в 3-ю строку дописать символы &quot;^&quot; (они будут экранировать спецсимволы &quot;|&quot;, &quot;&gt;&quot;, &quot;&amp;&quot;) и добавить вторые &quot;%&quot; к имени переменной ServiceName.<br /></p><div class="codebox"><pre><code>echo sc queryex %%ServiceName%%^|Find &quot;STATE&quot;^|Find &quot;STOP&quot;^&gt;Nul^&amp;^&amp; (shutdown /r /t 1)&gt;&gt;%F%</code></pre></div></blockquote></div><p>Спасиб большое</p>]]></content>
			<author>
				<name><![CDATA[henry.ford.2018]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42650</uri>
			</author>
			<updated>2022-07-05T19:52:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153793#p153793</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Создание батника с проверкой службы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153727#p153727" />
			<content type="html"><![CDATA[<p><strong>henry.ford.2018</strong>, нужно в 3-ю строку дописать символы &quot;^&quot; (они будут экранировать спецсимволы &quot;|&quot;, &quot;&gt;&quot;, &quot;&amp;&quot;) и добавить вторые &quot;%&quot; к имени переменной ServiceName.<br /></p><div class="codebox"><pre><code>echo sc queryex %%ServiceName%%^|Find &quot;STATE&quot;^|Find &quot;STOP&quot;^&gt;Nul^&amp;^&amp; (shutdown /r /t 1)&gt;&gt;%F%</code></pre></div>]]></content>
			<author>
				<name><![CDATA[andypetr]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40320</uri>
			</author>
			<updated>2022-07-01T11:21:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153727#p153727</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[CMD/BAT: Создание батника с проверкой службы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153722#p153722" />
			<content type="html"><![CDATA[<p>Нужно создать батник с кодом проверки состояния службы (выключена ли она), если выключена, то ребут ПК.<br /></p><div class="codebox"><pre><code>
set &quot;F=&quot;%ProgramFiles%\my.bat&quot;&quot;
echo @echo off&gt;%F%
echo set ServiceName=AnyDesk&gt;&gt;%F%
echo sc queryex %ServiceName%|Find &quot;STATE&quot;|Find &quot;STOP&quot;&gt;Nul&amp;&amp; (shutdown /r /t 1)&gt;&gt;%F%
</code></pre></div><p>По выше указанному коду создаётся неполный батник, типа:<br /></p><div class="codebox"><pre><code>
@echo off
set ServiceName=AnyDesk
</code></pre></div><p>Пожалуйста подскажите как подправить.</p>]]></content>
			<author>
				<name><![CDATA[henry.ford.2018]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42650</uri>
			</author>
			<updated>2022-07-01T09:44:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153722#p153722</id>
		</entry>
</feed>
