<?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: If Else statements in batch files</title>
	<atom:link href="http://www.markhneedham.com/blog/2008/08/13/if-else-statements-in-batch-files/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2008/08/13/if-else-statements-in-batch-files/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Sat, 11 Feb 2012 23:17:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Falconlarat</title>
		<link>http://www.markhneedham.com/blog/2008/08/13/if-else-statements-in-batch-files/comment-page-1/#comment-126197</link>
		<dc:creator>Falconlarat</dc:creator>
		<pubDate>Tue, 07 Feb 2012 00:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=98#comment-126197</guid>
		<description> not trying to call anyone out but this line;
~
if %was%==test (goto yes) else (goto no)
~
runs with no problems on 7 and vista</description>
		<content:encoded><![CDATA[<p> not trying to call anyone out but this line;<br />
~<br />
if %was%==test (goto yes) else (goto no)<br />
~<br />
runs with no problems on 7 and vista</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cccc</title>
		<link>http://www.markhneedham.com/blog/2008/08/13/if-else-statements-in-batch-files/comment-page-1/#comment-126175</link>
		<dc:creator>Cccc</dc:creator>
		<pubDate>Wed, 25 Jan 2012 22:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=98#comment-126175</guid>
		<description>@echo:disqus  off
echo HELLO WORLD!!!
echo Press any key to exit.
pause &gt; nul
exit</description>
		<content:encoded><![CDATA[<p>@echo:disqus  off<br />
echo HELLO WORLD!!!<br />
echo Press any key to exit.<br />
pause &gt; nul<br />
exit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Joseph Johnson</title>
		<link>http://www.markhneedham.com/blog/2008/08/13/if-else-statements-in-batch-files/comment-page-1/#comment-125370</link>
		<dc:creator>Michael Joseph Johnson</dc:creator>
		<pubDate>Fri, 26 Aug 2011 15:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=98#comment-125370</guid>
		<description>I am trying to set the following condition in a batch file. The user is required to enter syntax when prompted this part works
SET /P test=WWIDINFO Enter WWID
then I have an if like this
if &quot;%test%&quot; GTR &quot;0&quot; GOTO label1(Not sure if this is what I really want but it worke because I goto label and it executes what I want
:label1net user /domain %test% &gt; d:%test%.txtgoto :EOF

what I want here is to have an if that makes sure the text entered is the correct syntax
the sytax is correct with the following
llnnn (Where ll= letters and nnn=numbers
llnnl is also correct (Where the last letter is either d or a)
so my if should check this condition and if not ECHO Incorrect syntax) and return to :top ELSE goto :label</description>
		<content:encoded><![CDATA[<p>I am trying to set the following condition in a batch file. The user is required to enter syntax when prompted this part works<br />
SET /P test=WWIDINFO Enter WWID<br />
then I have an if like this<br />
if &#8220;%test%&#8221; GTR &#8220;0&#8243; GOTO label1(Not sure if this is what I really want but it worke because I goto label and it executes what I want<br />
:label1net user /domain %test% &gt; d:%test%.txtgoto :EOF</p>
<p>what I want here is to have an if that makes sure the text entered is the correct syntax<br />
the sytax is correct with the following<br />
llnnn (Where ll= letters and nnn=numbers<br />
llnnl is also correct (Where the last letter is either d or a)<br />
so my if should check this condition and if not ECHO Incorrect syntax) and return to :top ELSE goto :label</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Schoultz</title>
		<link>http://www.markhneedham.com/blog/2008/08/13/if-else-statements-in-batch-files/comment-page-1/#comment-125358</link>
		<dc:creator>Robert Schoultz</dc:creator>
		<pubDate>Sat, 20 Aug 2011 08:10:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=98#comment-125358</guid>
		<description>Hello Angshuman. I just found this site and I messed around a bit and I noticed IF ELSE statements will only work if it is positioned like this (Running Windows 7 here):

IF condition (
do something
) ELSE (
do something else
)

So in other words, this wont work:
IF condition ( do something ) ELSE ( do something else )


Batch language is picky ;).</description>
		<content:encoded><![CDATA[<p>Hello Angshuman. I just found this site and I messed around a bit and I noticed IF ELSE statements will only work if it is positioned like this (Running Windows 7 here):</p>
<p>IF condition (<br />
do something<br />
) ELSE (<br />
do something else<br />
)</p>
<p>So in other words, this wont work:<br />
IF condition ( do something ) ELSE ( do something else )</p>
<p>Batch language is picky <img src='http://www.markhneedham.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Angshuman</title>
		<link>http://www.markhneedham.com/blog/2008/08/13/if-else-statements-in-batch-files/comment-page-1/#comment-125073</link>
		<dc:creator>Angshuman</dc:creator>
		<pubDate>Wed, 03 Aug 2011 04:56:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=98#comment-125073</guid>
		<description>Hi Mark,
I am using the if else like below,

if Exist %loc%some_directorynul ( 	echo Exists ) else ( 	mkdir %loc%my_directory	)

which is giving me a 1kb unknown file with the name my_directory. Where I am doing the mistake could not find. Please help.</description>
		<content:encoded><![CDATA[<p>Hi Mark,<br />
I am using the if else like below,</p>
<p>if Exist %loc%some_directorynul ( 	echo Exists ) else ( 	mkdir %loc%my_directory	)</p>
<p>which is giving me a 1kb unknown file with the name my_directory. Where I am doing the mistake could not find. Please help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anu</title>
		<link>http://www.markhneedham.com/blog/2008/08/13/if-else-statements-in-batch-files/comment-page-1/#comment-34846</link>
		<dc:creator>Anu</dc:creator>
		<pubDate>Thu, 08 Apr 2010 09:37:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=98#comment-34846</guid>
		<description>What if the %cd$% resolves to a directory with brackets in it..
IF &quot;%1&quot;==&quot;.&quot;  (
  set WORKING_DIRECTORY=%cd%
) ELSE (
  set WORKING_DIRECTORY=%1
)
where %cd% resolves to say C:\abc(2)\bin

The if condition fails..</description>
		<content:encoded><![CDATA[<p>What if the %cd$% resolves to a directory with brackets in it..<br />
IF &#8220;%1&#8243;==&#8221;.&#8221;  (<br />
  set WORKING_DIRECTORY=%cd%<br />
) ELSE (<br />
  set WORKING_DIRECTORY=%1<br />
)<br />
where %cd% resolves to say C:\abc(2)\bin</p>
<p>The if condition fails..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Thomas</title>
		<link>http://www.markhneedham.com/blog/2008/08/13/if-else-statements-in-batch-files/comment-page-1/#comment-88</link>
		<dc:creator>Mark Thomas</dc:creator>
		<pubDate>Wed, 27 Aug 2008 19:24:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=98#comment-88</guid>
		<description>The tip about [] for empty args is really useful, often arguments contain spaces and so you end up with something like this which will break:

IF &quot;&quot;my 1st argument&quot;&quot;==&quot;&quot; GOTO Continue</description>
		<content:encoded><![CDATA[<p>The tip about [] for empty args is really useful, often arguments contain spaces and so you end up with something like this which will break:</p>
<p>IF &#8220;&#8221;my 1st argument&#8221;"==&#8221;" GOTO Continue</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Julian Simpson</title>
		<link>http://www.markhneedham.com/blog/2008/08/13/if-else-statements-in-batch-files/comment-page-1/#comment-37</link>
		<dc:creator>Julian Simpson</dc:creator>
		<pubDate>Sun, 17 Aug 2008 19:12:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=98#comment-37</guid>
		<description>Mark,

I&#039;m with you on Cygwin where you need to redistribute the Cygwin binaries.  It&#039;s painful.  I&#039;m betting on dynamic languages.

Once Iron Ruby has a production release I think it will be very compelling for this kind of thing.

Something has to put batch programming to bed ...</description>
		<content:encoded><![CDATA[<p>Mark,</p>
<p>I&#8217;m with you on Cygwin where you need to redistribute the Cygwin binaries.  It&#8217;s painful.  I&#8217;m betting on dynamic languages.</p>
<p>Once Iron Ruby has a production release I think it will be very compelling for this kind of thing.</p>
<p>Something has to put batch programming to bed &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2008/08/13/if-else-statements-in-batch-files/comment-page-1/#comment-27</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Thu, 14 Aug 2008 17:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=98#comment-27</guid>
		<description>The reason I&#039;m not using cygwin is because we&#039;re using the same script to deploy stuff on different machines e.g. one for QA, one for Showcase etc and for flexibility it seemed easier just to work with the lowest denominator.</description>
		<content:encoded><![CDATA[<p>The reason I&#8217;m not using cygwin is because we&#8217;re using the same script to deploy stuff on different machines e.g. one for QA, one for Showcase etc and for flexibility it seemed easier just to work with the lowest denominator.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jayesh</title>
		<link>http://www.markhneedham.com/blog/2008/08/13/if-else-statements-in-batch-files/comment-page-1/#comment-25</link>
		<dc:creator>Jayesh</dc:creator>
		<pubDate>Thu, 14 Aug 2008 09:46:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=98#comment-25</guid>
		<description>Can you not use cygwin?</description>
		<content:encoded><![CDATA[<p>Can you not use cygwin?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

