<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Advanced Windows Batch File Scripting</title>
	<atom:link href="http://www.askapache.com/windows/advanced-batch-scripting.html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.askapache.com/windows/advanced-batch-scripting.html</link>
	<description>Advanced Web Development</description>
	<lastBuildDate>Thu, 16 May 2013 00:37:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Thomas Elliott</title>
		<link>http://www.askapache.com/windows/advanced-batch-scripting.html#comment-14807</link>
		<dc:creator>Thomas Elliott</dc:creator>
		<pubDate>Thu, 16 May 2013 00:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/?p=4577#comment-14807</guid>
		<description><![CDATA[some pretty slick stuff here. thanks for sharing.]]></description>
		<content:encoded><![CDATA[<p>some pretty slick stuff here. thanks for sharing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A Person</title>
		<link>http://www.askapache.com/windows/advanced-batch-scripting.html#comment-12425</link>
		<dc:creator>A Person</dc:creator>
		<pubDate>Sun, 17 Feb 2013 18:39:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/?p=4577#comment-12425</guid>
		<description><![CDATA[Windows batch scripts look so ugly in comparison to Unix shell scripts: the inconsistent use of upper and lower case, generally much harder to read overall particularly for loops - e.g.

&lt;pre&gt;for i in {1..5}
do
    echo &quot;Value: $i&quot;
done&lt;/pre&gt;

is clearly much easier to read.

The constant use of &amp;&amp; is also a nightmare, in comparison to the c-style semicolon terminator used in bash scripts.

&lt;code&gt;SET&lt;/code&gt; also seems pointless and completely illogical in comparison to other languages, where you can just do &lt;code&gt;var=value;&lt;/code&gt;

No idea what the guys at Microsoft were on when they invented batch scripting...]]></description>
		<content:encoded><![CDATA[<p>Windows batch scripts look so ugly in comparison to Unix shell scripts: the inconsistent use of upper and lower case, generally much harder to read overall particularly for loops - e.g.</p>
<pre>for i in {1..5}
do
    echo "Value: $i"
done</pre>
<p>is clearly much easier to read.</p>
<p>The constant use of &amp;&amp; is also a nightmare, in comparison to the c-style semicolon terminator used in bash scripts.</p>
<p><code>SET</code> also seems pointless and completely illogical in comparison to other languages, where you can just do <code>var=value;</code></p>
<p>No idea what the guys at Microsoft were on when they invented batch scripting...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CobaltDawg</title>
		<link>http://www.askapache.com/windows/advanced-batch-scripting.html#comment-11148</link>
		<dc:creator>CobaltDawg</dc:creator>
		<pubDate>Tue, 12 Feb 2013 18:16:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/?p=4577#comment-11148</guid>
		<description><![CDATA[This is pretty awesome. Sadly, I&#039;m still pretty new to scripting, but here&#039;s what I was thinking...

I want to be able to run a script every x minutes that will check the status of a specific port. If the port shows activity, then check again in x minutes, but if the port is showing no activity, restart the PC..

From what I&#039;ve read, it should look something like this ... Is this correct? Any help would be greatly appreciated!

&lt;pre&gt;
REM CHECK PORT IS LISTENING (FOR SOCKISFIED TUNNEL)
CALL :PORTCHECK %_PPORT%
REM =======================================================================================
REM =   PORTCHECK - Check that Port is being used (for tunnels)
REM =======================================================================================
:PORTCHECK
netstat.exe -n -v -a -p TCP &#124; FIND &quot;ESTABLISHED&quot; &#124; FIND &quot;:%~1&quot; &amp;&gt;nul 2&amp;&gt;1
IF ERRORLEVEL 1 CALL :SHUTDOWNIN
SHUTDOWN -r -t &quot;%~1&quot; &amp;&amp; EXIT /B
EXIT /B
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>This is pretty awesome. Sadly, I'm still pretty new to scripting, but here's what I was thinking...</p>
<p>I want to be able to run a script every x minutes that will check the status of a specific port. If the port shows activity, then check again in x minutes, but if the port is showing no activity, restart the PC..</p>
<p>From what I've read, it should look something like this ... Is this correct? Any help would be greatly appreciated!</p>
<pre>REM CHECK PORT IS LISTENING (FOR SOCKISFIED TUNNEL)
CALL :PORTCHECK %_PPORT%
REM =======================================================================================
REM =   PORTCHECK - Check that Port is being used (for tunnels)
REM =======================================================================================
:PORTCHECK
netstat.exe -n -v -a -p TCP | FIND "ESTABLISHED" | FIND ":%~1" &amp;&gt;nul 2&amp;&gt;1
IF ERRORLEVEL 1 CALL :SHUTDOWNIN
SHUTDOWN -r -t "%~1" &amp;&amp; EXIT /B
EXIT /B</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fred</title>
		<link>http://www.askapache.com/windows/advanced-batch-scripting.html#comment-8768</link>
		<dc:creator>Fred</dc:creator>
		<pubDate>Sun, 03 Feb 2013 09:45:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/?p=4577#comment-8768</guid>
		<description><![CDATA[I am a computer noob that unwitting wandered onto this site.
CAN SOMEONE TELL ME WHAT THE HELL IS GOING ON??!!]]></description>
		<content:encoded><![CDATA[<p>I am a computer noob that unwitting wandered onto this site.<br />
CAN SOMEONE TELL ME WHAT THE HELL IS GOING ON??!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.askapache.com/windows/advanced-batch-scripting.html#comment-3815</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Tue, 18 Dec 2012 21:54:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/?p=4577#comment-3815</guid>
		<description><![CDATA[I&#039;m attempting to write a batch script to ping the entire scope of our network, then use the &quot;good&quot; replies back to get systeminfo for each IP address that comes back.  I&#039;m not sure if the below is correct but i know the systeminfo part is good.  your assistance is much appreciated.
&lt;pre&gt;
: Turn off the echo
@echo off
&#160;
: Setting the color of background and text
color 0c
&#160;
: Display nothing but add whitespace
echo.
&#160;
@echo OFF
FOR /L %i IN (1,1,254) DO ping -n 1 x.x.x.%i
&#160;
: Displaying text
echo Exporting System Info...
&#160;
systeminfo /s x.x.x.x &#124; findstr /c:&quot;Host Name&quot; &gt;\\server
systeminfo /s x.x.x.x &#124; findstr /c:&quot;System Model&quot; &gt;&gt;\\server
systeminfo /s x.x.x.x &#124; findstr /c:&quot;[01]&quot; &gt;&gt;\\server
&#160;
echo. 
echo. 
&#160;
echo Service Tag: 
wmic /node:x.x.x.x bios get serialnumber &gt;&gt;\\server
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>I'm attempting to write a batch script to ping the entire scope of our network, then use the "good" replies back to get systeminfo for each IP address that comes back.  I'm not sure if the below is correct but i know the systeminfo part is good.  your assistance is much appreciated.</p>
<pre>: Turn off the echo
@echo off
&nbsp;
: Setting the color of background and text
color 0c
&nbsp;
: Display nothing but add whitespace
echo.
&nbsp;
@echo OFF
FOR /L %i IN (1,1,254) DO ping -n 1 x.x.x.%i
&nbsp;
: Displaying text
echo Exporting System Info...
&nbsp;
systeminfo /s x.x.x.x | findstr /c:"Host Name" &gt;\\server
systeminfo /s x.x.x.x | findstr /c:"System Model" &gt;&gt;\\server
systeminfo /s x.x.x.x | findstr /c:"[01]" &gt;&gt;\\server
&nbsp;
echo. 
echo. 
&nbsp;
echo Service Tag: 
wmic /node:x.x.x.x bios get serialnumber &gt;&gt;\\server</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheila</title>
		<link>http://www.askapache.com/windows/advanced-batch-scripting.html#comment-3809</link>
		<dc:creator>Sheila</dc:creator>
		<pubDate>Tue, 18 Dec 2012 18:47:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/?p=4577#comment-3809</guid>
		<description><![CDATA[What I need I don&#039;t believe is terribly complicated, but I am normally a unix user and not particurlarly adept in windows, but I have a need to capture information in a text file on a windows 2003 server and then email it.

I need the date format to be &lt;code&gt;dd/MONTH/yyyy  - MONTH = 3 char&lt;/code&gt; in uppercase. The date will always be the current one.

I need to incorporate this into a command to be run as a scheduled task along with another command which will create a different file that does not need this date in the command.

example of commands I will be using:

&lt;pre&gt;cautil &quot;select conlog MSG=&#039;*forced*&#039; START=18/DEC/2012 END=18/DEC/2012 LIST conlog expand=Y output=E:\forced-CONLOG.log&quot;
rmtcntrl status &gt; rmtcntrl-status.txt&lt;/pre&gt;

I could work this out in perl, however no perl here. ]]></description>
		<content:encoded><![CDATA[<p>What I need I don't believe is terribly complicated, but I am normally a unix user and not particurlarly adept in windows, but I have a need to capture information in a text file on a windows 2003 server and then email it.</p>
<p>I need the date format to be <code>dd/MONTH/yyyy  - MONTH = 3 char</code> in uppercase. The date will always be the current one.</p>
<p>I need to incorporate this into a command to be run as a scheduled task along with another command which will create a different file that does not need this date in the command.</p>
<p>example of commands I will be using:</p>
<pre>cautil "select conlog MSG='*forced*' START=18/DEC/2012 END=18/DEC/2012 LIST conlog expand=Y output=E:\forced-CONLOG.log"
rmtcntrl status &gt; rmtcntrl-status.txt</pre>
<p>I could work this out in perl, however no perl here. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AskApache</title>
		<link>http://www.askapache.com/windows/advanced-batch-scripting.html#comment-3296</link>
		<dc:creator>AskApache</dc:creator>
		<pubDate>Tue, 04 Dec 2012 09:54:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/?p=4577#comment-3296</guid>
		<description><![CDATA[&lt;p&gt;&lt;strong&gt;@John&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Normally I&#039;d say GRTFM, but since this is windows batch, hey what the heck.  Here ya go.&lt;/p&gt;
&lt;pre&gt;@ECHO OFF
&#160;
SET NPEXE=C:\Program Files (x86)\Notepad++\notepad++.exe
SET NPIMG=notepad++.exe
SET NPINSTALLER=C:\Program Files (x86)\Notepad++\notenpp.6.2.Installer.exe /S
&#160;
tasklist.exe /V /FO TABLE /NH /FI &quot;IMAGENAME eq %NPIMG%&quot; 2&gt;NUL &#124; FIND &quot;%NPIMG% &quot; &gt;NUL 2&gt;&amp;1
IF ERRORLEVEL 1 (
  ECHO %NPIMG% not running, starting
  START /D&quot;C:\Program Files (x86)\Notepad++&quot; %NPIMG%
) ELSE (
  ECHO %NPIMG% already running, killing
  tskill %NPIMG%
  ECHO Starting installer
  START /D&quot;C:\Program Files (x86)\Notepad++&quot; %NPINSTALLER%
  SLEEP 5
  ECHO Starting notepad++
  START /D&quot;C:\Program Files (x86)\Notepad++&quot; %NPIMG%
)
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p><strong>@John</strong></p>
<p>Normally I'd say GRTFM, but since this is windows batch, hey what the heck.  Here ya go.</p>
<pre>@ECHO OFF
&nbsp;
SET NPEXE=C:\Program Files (x86)\Notepad++\notepad++.exe
SET NPIMG=notepad++.exe
SET NPINSTALLER=C:\Program Files (x86)\Notepad++\notenpp.6.2.Installer.exe /S
&nbsp;
tasklist.exe /V /FO TABLE /NH /FI "IMAGENAME eq %NPIMG%" 2&gt;NUL | FIND "%NPIMG% " &gt;NUL 2&gt;&amp;1
IF ERRORLEVEL 1 (
  ECHO %NPIMG% not running, starting
  START /D"C:\Program Files (x86)\Notepad++" %NPIMG%
) ELSE (
  ECHO %NPIMG% already running, killing
  tskill %NPIMG%
  ECHO Starting installer
  START /D"C:\Program Files (x86)\Notepad++" %NPINSTALLER%
  SLEEP 5
  ECHO Starting notepad++
  START /D"C:\Program Files (x86)\Notepad++" %NPIMG%
)</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: jack</title>
		<link>http://www.askapache.com/windows/advanced-batch-scripting.html#comment-3167</link>
		<dc:creator>jack</dc:creator>
		<pubDate>Fri, 02 Nov 2012 17:13:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/?p=4577#comment-3167</guid>
		<description><![CDATA[&lt;p&gt;please help me make this shorter and easier&lt;/p&gt;
&lt;pre&gt;@echo off
color 09
&#160;
echo loading 1 %
ping localhost -n 1 &gt;nul
cls
echo loading 2 %
ping localhost -n 1 &gt;nul
cls
echo loading 3 %
ping localhost -n 1 &gt;nul
...
echo loading 100 %
ping localhost -n 2 &gt;nul&lt;/pre&gt;
]]></description>
		<content:encoded><![CDATA[<p>please help me make this shorter and easier</p>
<pre>@echo off
color 09
&nbsp;
echo loading 1 %
ping localhost -n 1 &gt;nul
cls
echo loading 2 %
ping localhost -n 1 &gt;nul
cls
echo loading 3 %
ping localhost -n 1 &gt;nul
...
echo loading 100 %
ping localhost -n 2 &gt;nul</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.askapache.com/windows/advanced-batch-scripting.html#comment-3166</link>
		<dc:creator>John</dc:creator>
		<pubDate>Thu, 25 Oct 2012 13:32:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/?p=4577#comment-3166</guid>
		<description><![CDATA[&lt;p&gt;Hi - Can someone help me. Im trying to create a batch file please that would do the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;check to see if application is running&lt;/li&gt;
&lt;li&gt;if its open then close running app&lt;/li&gt;
&lt;li&gt;then run installation.exe&lt;/li&gt;
&lt;li&gt;then relaunch application&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I have some of it already mentioned below. But im missing some of the other commands on the script&lt;/p&gt;

&lt;p&gt;So in other words something like this. please fill what im missing.&lt;/p&gt;
&lt;pre&gt;@echo off
Var opened = false
If (notepad++ is opened)
tskill notepad++ &gt; NUL
opened = true
c:notenpp.6.2.Installer.exe /S
if (opened = true)
start &quot;&quot; &quot;C:Program Files (x86)Notepad++notepad++.exe&quot;&lt;/pre&gt;
&lt;p&gt;Please HELP!!!!&lt;/p&gt;]]></description>
		<content:encoded><![CDATA[<p>Hi - Can someone help me. Im trying to create a batch file please that would do the following:</p>
<ol>
<li>check to see if application is running</li>
<li>if its open then close running app</li>
<li>then run installation.exe</li>
<li>then relaunch application</li>
</ol>
<p>I have some of it already mentioned below. But im missing some of the other commands on the script</p>
<p>So in other words something like this. please fill what im missing.</p>
<pre>@echo off
Var opened = false
If (notepad++ is opened)
tskill notepad++ &gt; NUL
opened = true
c:notenpp.6.2.Installer.exe /S
if (opened = true)
start "" "C:Program Files (x86)Notepad++notepad++.exe"</pre>
<p>Please HELP!!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AskApache</title>
		<link>http://www.askapache.com/windows/advanced-batch-scripting.html#comment-3164</link>
		<dc:creator>AskApache</dc:creator>
		<pubDate>Tue, 28 Feb 2012 14:56:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/?p=4577#comment-3164</guid>
		<description><![CDATA[&lt;pre&gt;@ECHO OFF&amp;&amp; SETLOCAL&amp;&amp; PUSHD &quot;%~dp0&quot;&amp;&amp; SETLOCAL ENABLEDELAYEDEXPANSION&amp;&amp; SETLOCAL ENABLEEXTENSIONS&amp;&amp; SET V=5&amp;&amp; IF NOT &quot;!V!&quot;==&quot;5&quot; (ECHO DelayedExpansion Failed&amp;&amp; GOTO :EOF)
&#160;
REM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
REM ++                                                                                                                                                                                                ++
REM ++   SCRIPT LOCAL VARIABLES                                                                                                                                                                       ++
REM ++                                                                                                                                                                                                ++
REM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
&#160;
SET _FIREFOXBIN=C:Program FilesMozilla Firefoxfirefox.exe
SET PATH=%ProgramFiles%;%PATH%
SET _PLOG=L:PPPatlog.log
&#160;
REM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
REM ++                                                                                                                                                                                                ++
REM ++   MAIN PROGRAM EXECUTION                                                                                                                                                                       ++
REM ++                                                                                                                                                                                                ++
REM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
&#160;
REM CREATE AT JOB TO RUN THIS SCRIPT EVERY 5 MINUTES
CALL :CREATEATJOB
&#160;
CALL :STARTFIREFOX
&#160;
:: CHECK ONLY 1 FIREFOX IS RUNNING
CALL :FIREFOXCHECKMULTI
&#160;
POPD &amp;&amp; ENDLOCAL &amp;&amp; EXIT &amp;&amp; EXIT
GOTO :EOF
&#160;
REM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
REM ++                                                                                                                                                                                                ++
REM ++   SCRIPT FUNCTIONS                                                                                                                                                                             ++
REM ++                                                                                                                                                                                                ++
REM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
&#160;
REM =========================================================================================================================================================================
REM =   STARTFIREFOX
REM =========================================================================================================================================================================
:STARTFIREFOX
ECHO.&amp;&amp; ECHO STARTING FIREFOX
CALL :KILLDUPES &quot;firefox.exe&quot;
START &quot;firefox&quot; /HIGH /MIN  &quot;%_FIREFOXBIN%&quot;
IF ERRORLEVEL 1 ( CALL :SPEAK &quot;FAILED. START FIREFOX&quot; ) ELSE ( ECHO OK )
EXIT /B
&#160;
REM =======================================================================================
REM =   CREATEATJOB - runs job (START this file) every 5 minutes
REM =======================================================================================
:CREATEATJOB
ECHO.&amp;&amp; ECHO CREATE AT JOB
AT &#124; FOR /F &quot;tokens=1&quot; %%i IN (&#039;FIND /I &quot;%~f0&quot;&#039;) DO AT %%i /delete /yes &gt;NUL 2&gt;&amp;1
SET /A H=!TIME:~0,2!&amp;&amp; SET M=!TIME:~3,2!
SET Y=%H%:%M%&amp;&amp; SET /A M+=5
IF !M! GEQ 60 ( SET /A H+=1&amp;&amp;SET /A M-=60 )
IF !H! GEQ 24 SET /A H-=24
SET M=0!M!&amp;&amp; SET H=0!H!
AT %H:~-2%:%M:~-2% /INTERACTIVE %ComSpec% /E:ON /D /Q /C START /MIN %ComSpec% /E:ON /D /Q /C &quot;%~f0&quot; &gt;NUL 2&gt;&amp;1
ECHO OK
EXIT /B
&#160;
REM =======================================================================================
REM =   KILLDUPES - kills duplicate processes, except for the one with lowest pid
REM =======================================================================================
:KILLDUPES
ECHO.&amp;&amp; ECHO KILLING DUPLICATE FIREFOXS
REM Check that more than 1 process is running
::tasklist.exe /V /NH /FI &quot;IMAGENAME eq %~1&quot; /FI &quot;USERNAME eq SYSTEM&quot; 2&gt;nul &#124; FIND /C &quot;K Running&quot; &#124; FIND &quot;1&quot; &gt;nul 2&gt;&amp;1
tasklist.exe /V /NH /FI &quot;IMAGENAME eq %~1&quot; 2&gt;nul &#124; FIND /C &quot;K Running&quot; &#124; FIND &quot;1&quot; &gt;nul 2&gt;&amp;1
IF NOT ERRORLEVEL 1 EXIT /B
&#160;
REM Create Filename in current dir (of this script)
SET _CMDS=%TEMP%killdupes.log
&#160;
REM Create the file in the same dir as this script named for date and sorted by PID
tasklist.exe /V /NH /FI &quot;IMAGENAME eq %~1&quot; 2&gt;nul &#124; SORT /+29 &gt; &quot;%_CMDS%&quot;
&#160;
REM Check that the file was created or exit
IF NOT EXIST &quot;%_CMDS%&quot; ( CALL :SPEAK &quot;FILE CREATION FAILED&quot; &amp;&amp; EXIT /B )
&#160;
REM kill all the processes found except for 1, do not kill the process with the lowest pid number
FOR /F &quot;usebackq tokens=2 skip=2&quot; %%p IN (`type &quot;%_CMDS%&quot;`) DO taskkill.exe /F /PID %%p /T &gt;nul 2&gt;&amp;1
&#160;
REM erase the file
ERASE /Q &quot;%_CMDS%&quot; &gt;nul 2&gt;&amp;1
&#160;
REM check that the file was erased
IF EXIST &quot;%_CMDS%&quot; ( CALL :SPEAK &quot;ERASE FILE FAILED&quot; &amp;&amp; EXIT /B )
&#160;
EXIT /B
&#160;
REM =======================================================================================
REM =   SPEAK - Speak text
REM =======================================================================================
:SPEAK
ECHO %~1
EXIT /B&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<pre>@ECHO OFF&amp;&amp; SETLOCAL&amp;&amp; PUSHD "%~dp0"&amp;&amp; SETLOCAL ENABLEDELAYEDEXPANSION&amp;&amp; SETLOCAL ENABLEEXTENSIONS&amp;&amp; SET V=5&amp;&amp; IF NOT "!V!"=="5" (ECHO DelayedExpansion Failed&amp;&amp; GOTO :EOF)
&nbsp;
REM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
REM ++                                                                                                                                                                                                ++
REM ++   SCRIPT LOCAL VARIABLES                                                                                                                                                                       ++
REM ++                                                                                                                                                                                                ++
REM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
&nbsp;
SET _FIREFOXBIN=C:Program FilesMozilla Firefoxfirefox.exe
SET PATH=%ProgramFiles%;%PATH%
SET _PLOG=L:PPPatlog.log
&nbsp;
REM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
REM ++                                                                                                                                                                                                ++
REM ++   MAIN PROGRAM EXECUTION                                                                                                                                                                       ++
REM ++                                                                                                                                                                                                ++
REM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
&nbsp;
REM CREATE AT JOB TO RUN THIS SCRIPT EVERY 5 MINUTES
CALL :CREATEATJOB
&nbsp;
CALL :STARTFIREFOX
&nbsp;
:: CHECK ONLY 1 FIREFOX IS RUNNING
CALL :FIREFOXCHECKMULTI
&nbsp;
POPD &amp;&amp; ENDLOCAL &amp;&amp; EXIT &amp;&amp; EXIT
GOTO :EOF
&nbsp;
REM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
REM ++                                                                                                                                                                                                ++
REM ++   SCRIPT FUNCTIONS                                                                                                                                                                             ++
REM ++                                                                                                                                                                                                ++
REM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
&nbsp;
REM =========================================================================================================================================================================
REM =   STARTFIREFOX
REM =========================================================================================================================================================================
:STARTFIREFOX
ECHO.&amp;&amp; ECHO STARTING FIREFOX
CALL :KILLDUPES "firefox.exe"
START "firefox" /HIGH /MIN  "%_FIREFOXBIN%"
IF ERRORLEVEL 1 ( CALL :SPEAK "FAILED. START FIREFOX" ) ELSE ( ECHO OK )
EXIT /B
&nbsp;
REM =======================================================================================
REM =   CREATEATJOB - runs job (START this file) every 5 minutes
REM =======================================================================================
:CREATEATJOB
ECHO.&amp;&amp; ECHO CREATE AT JOB
AT | FOR /F "tokens=1" %%i IN ('FIND /I "%~f0"') DO AT %%i /delete /yes &gt;NUL 2&gt;&amp;1
SET /A H=!TIME:~0,2!&amp;&amp; SET M=!TIME:~3,2!
SET Y=%H%:%M%&amp;&amp; SET /A M+=5
IF !M! GEQ 60 ( SET /A H+=1&amp;&amp;SET /A M-=60 )
IF !H! GEQ 24 SET /A H-=24
SET M=0!M!&amp;&amp; SET H=0!H!
AT %H:~-2%:%M:~-2% /INTERACTIVE %ComSpec% /E:ON /D /Q /C START /MIN %ComSpec% /E:ON /D /Q /C "%~f0" &gt;NUL 2&gt;&amp;1
ECHO OK
EXIT /B
&nbsp;
REM =======================================================================================
REM =   KILLDUPES - kills duplicate processes, except for the one with lowest pid
REM =======================================================================================
:KILLDUPES
ECHO.&amp;&amp; ECHO KILLING DUPLICATE FIREFOXS
REM Check that more than 1 process is running
::tasklist.exe /V /NH /FI "IMAGENAME eq %~1" /FI "USERNAME eq SYSTEM" 2&gt;nul | FIND /C "K Running" | FIND "1" &gt;nul 2&gt;&amp;1
tasklist.exe /V /NH /FI "IMAGENAME eq %~1" 2&gt;nul | FIND /C "K Running" | FIND "1" &gt;nul 2&gt;&amp;1
IF NOT ERRORLEVEL 1 EXIT /B
&nbsp;
REM Create Filename in current dir (of this script)
SET _CMDS=%TEMP%killdupes.log
&nbsp;
REM Create the file in the same dir as this script named for date and sorted by PID
tasklist.exe /V /NH /FI "IMAGENAME eq %~1" 2&gt;nul | SORT /+29 &gt; "%_CMDS%"
&nbsp;
REM Check that the file was created or exit
IF NOT EXIST "%_CMDS%" ( CALL :SPEAK "FILE CREATION FAILED" &amp;&amp; EXIT /B )
&nbsp;
REM kill all the processes found except for 1, do not kill the process with the lowest pid number
FOR /F "usebackq tokens=2 skip=2" %%p IN (`type "%_CMDS%"`) DO taskkill.exe /F /PID %%p /T &gt;nul 2&gt;&amp;1
&nbsp;
REM erase the file
ERASE /Q "%_CMDS%" &gt;nul 2&gt;&amp;1
&nbsp;
REM check that the file was erased
IF EXIST "%_CMDS%" ( CALL :SPEAK "ERASE FILE FAILED" &amp;&amp; EXIT /B )
&nbsp;
EXIT /B
&nbsp;
REM =======================================================================================
REM =   SPEAK - Speak text
REM =======================================================================================
:SPEAK
ECHO %~1
EXIT /B</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
