<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>just_add_watir &#124; Advanced recipes for Watir &#187; batch</title>
	<atom:link href="http://justaddwatir.com/tag/batch/feed/" rel="self" type="application/rss+xml" />
	<link>http://justaddwatir.com</link>
	<description>Advanced recipes for Watir</description>
	<lastBuildDate>Wed, 21 Oct 2009 02:44:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Q. How do I check for running browsers?</title>
		<link>http://justaddwatir.com/2008/q-how-do-i-check-for-running-browsers/</link>
		<comments>http://justaddwatir.com/2008/q-how-do-i-check-for-running-browsers/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 08:23:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[watir]]></category>
		<category><![CDATA[batch]]></category>

		<guid isPermaLink="false">http://justaddwatir.com/watir/?p=9</guid>
		<description><![CDATA[A. Wrap script execution in a batch file ...
Example batch:

:Check for running processes
FOR /F &#34;tokens=1&#34; %%G IN &#40;'tasklist /FI &#34;IMAGENAME eq ruby.exe&#34; /NH'&#41; DO &#40;
IF &#34;%%G&#34;==&#34;ruby.exe&#34; exit 100
&#41;
FOR /F &#34;tokens=1&#34; %%G IN &#40;'tasklist /FI &#34;IMAGENAME eq IEXPLORE.EXE&#34; /NH'&#41; DO &#40;
IF &#34;%%G&#34;==&#34;IEXPLORE.EXE&#34; exit 100
&#41;
:Execute script
ruby test_suite.rb
SET STATUS=%ERRORLEVEL%
:Clean up zombies
taskkill /F /FI &#34;USERNAME eq SYSTEM&#34; /IM IEXPLORE.EXE
taskkill [...]]]></description>
			<content:encoded><![CDATA[<p><strong>A. Wrap script execution in a batch file ...</strong><br />
Example batch:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">:<span style="color: #b100b1; font-weight: bold;">Check <span style="color: #00b100; font-weight: bold;">for</span> running processes</span>
<span style="color: #00b100; font-weight: bold;">FOR</span> /F &quot;tokens=<span style="color: #cc66cc;">1</span>&quot; <span style="color: #33cc33;">%%</span><span style="color: #448888;">G</span> <span style="color: #00b100; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span>'tasklist /FI &quot;IMAGENAME eq ruby.exe&quot; /NH'<span style="color: #66cc66;">&#41;</span> <span style="color: #00b100; font-weight: bold;">DO</span> <span style="color: #66cc66;">&#40;</span>
<span style="color: #00b100; font-weight: bold;">IF</span> &quot;<span style="color: #33cc33;">%%</span><span style="color: #448888;">G</span>&quot;==&quot;ruby.exe&quot; <span style="color: #00b100; font-weight: bold;">exit</span> <span style="color: #cc66cc;">100</span>
<span style="color: #66cc66;">&#41;</span>
<span style="color: #00b100; font-weight: bold;">FOR</span> /F &quot;tokens=<span style="color: #cc66cc;">1</span>&quot; <span style="color: #33cc33;">%%</span><span style="color: #448888;">G</span> <span style="color: #00b100; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span>'tasklist /FI &quot;IMAGENAME eq IEXPLORE.EXE&quot; /NH'<span style="color: #66cc66;">&#41;</span> <span style="color: #00b100; font-weight: bold;">DO</span> <span style="color: #66cc66;">&#40;</span>
<span style="color: #00b100; font-weight: bold;">IF</span> &quot;<span style="color: #33cc33;">%%</span><span style="color: #448888;">G</span>&quot;==&quot;IEXPLORE.EXE&quot; <span style="color: #00b100; font-weight: bold;">exit</span> <span style="color: #cc66cc;">100</span>
<span style="color: #66cc66;">&#41;</span>
:<span style="color: #b100b1; font-weight: bold;">Execute script</span>
ruby test_suite.rb
<span style="color: #b1b100; font-weight: bold;">SET</span> <span style="color: #448844;">STATUS</span>=<span style="color: #33cc33;">%</span><span style="color: #448888;">ERRORLEVEL</span><span style="color: #33cc33;">%</span>
:<span style="color: #b100b1; font-weight: bold;">Clean up zombies</span>
taskkill /F /FI &quot;USERNAME eq SYSTEM&quot; /IM IEXPLORE.EXE
taskkill /F /FI &quot;USERNAME eq SYSTEM&quot; /IM ruby.exe
<span style="color: #00b100; font-weight: bold;">exit</span> <span style="color: #33cc33;">%</span><span style="color: #448888;">STATUS</span><span style="color: #33cc33;">%</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://justaddwatir.com/2008/q-how-do-i-check-for-running-browsers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
