<?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>yadUK - Effective Information System Solutions &#187; batch</title>
	<atom:link href="http://www.yaduk.co.uk/tag/batch/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yaduk.co.uk</link>
	<description>Effective Information System Solutions</description>
	<lastBuildDate>Thu, 01 Apr 2010 18:43:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Interactive BATCH file with DEBUG script</title>
		<link>http://www.yaduk.co.uk/2009/04/26/interactive-batch-file-with-debug-script/</link>
		<comments>http://www.yaduk.co.uk/2009/04/26/interactive-batch-file-with-debug-script/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 14:38:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[batch]]></category>

		<guid isPermaLink="false">http://www.yaduk.co.uk/?p=218</guid>
		<description><![CDATA[<p>Still sometimes need to use batch files to do stuff even in this day and age? Yes, is the usual answer but, unfortunately many of the standard errorlevel checking tools such as CHOICE etc. have either been removed or cannot be used without administrator access in Enterprise environments.</p>
<p>It&#8217;s not&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Still sometimes need to use batch files to do stuff even in this day and age? Yes, is the usual answer but, unfortunately many of the standard errorlevel checking tools such as CHOICE etc. have either been removed or cannot be used without administrator access in Enterprise environments.</p>
<p>It&#8217;s not always entirely wise either to install compiled errorlevel tools into an Enterprise environment. This will potentially go against an application or network policy or you&#8217;re just plain unable to.</p>
<p>The below batch file instead is self-contained outputting a DEBUG script before compiling it and utilising it to check for user input. This it utilises within the demo. Save the text down to a textfile and give it the extension .bat</p>
<p>It is an extension of and use of the following Microsoft support site example - <a title="Accepting Keyboard Input in Batch Files" href="http://support.microsoft.com/kb/77457" target="_blank">Accepting Keyboard Input in Batch Files</a>. Note that there should be a backslash after %temp% and before the word REPLY which is being stripped out by this parser.</p>
<textarea cols="40" rows="10" name="code" class="Php">@echo OFF
	if not exist %Temp%keyc.COM GOTO CREATETOOL
:START
	cls
	echo Dynamic Key Checker .bat
	echo .................................
	echo.
	echo Do you want to continue?
	echo (Y) Yes
	echo (N) No
	echo (X) eXit
	echo (y/n/x)?
	keyc
	if errorlevel 121 if not errorlevel 122 GOTO YES
	if errorlevel 89 if not errorlevel 90 GOTO YES
	if errorlevel 110 if not errorlevel 111 GOTO NO
	if errorlevel 78 if not errorlevel 79 GOTO NO
	if errorlevel 88 if not errorlevel 89 GOTO EXIT
	if errorlevel 120 if not errorlevel 121 GOTO EXIT
	GOTO START
:YES
	echo You pressed "Yes"
	GOTO END
:NO
	echo You pressed "No"
	GOTO END
:EXIT
	echo You pressed "eXit"
	GOTO END
:CREATETOOL
:: This is a simple errorlevel tool created in DEBUG
	>> %TEMP%~keyc echo A 100 
	>> %Temp%~keyc echo MOV AH,08 
	>> %Temp%~keyc echo INT 21 
	>> %Temp%~keyc echo CMP AL,0 
	>> %Temp%~keyc echo JNZ 010A 
	>> %Temp%~keyc echo INT 21 
	>> %Temp%~keyc echo MOV AH,4C 
	>> %Temp%~keyc echo INT 21 
	>> %Temp%~keyc echo. 
	>> %Temp%~keyc echo RCX 
	>> %Temp%~keyc echo E 
	>> %Temp%~keyc echo N keyc.COM 
	>> %Temp%~keyc echo W 
	>> %Temp%~keyc echo Q 
	echo. 
	DEBUG < %Temp%~keyc
	if not errorlevel 0 GOTO DEBUGERROR
	GOTO START
:DEBUGERROR
	set error=DEBUG ERROR !!
	GOTO ERROR
:END
	echo Press any key to exit . . . 
	pause > nul</textarea>
	<!-- WordPress Code Snippet -->
	<script type="text/javascript" src="http://www.yaduk.co.uk/wp-content/plugins/wordpress-code-snippet/js/shCore.js"></script><script type="text/javascript" src="http://www.yaduk.co.uk/wp-content/plugins/wordpress-code-snippet/js/shBrushPhp.js"></script>
	<link type="text/css" rel="stylesheet" href="http://www.yaduk.co.uk/wp-content/plugins/wordpress-code-snippet/css/SyntaxHighlighter.css"/>
	
	<script language="javascript">
	dp.SyntaxHighlighter.ClipboardSwf = 'http://www.yaduk.co.uk/wp-content/plugins/wordpress-code-snippet/js/clipboard.swf';
	dp.SyntaxHighlighter.HighlightAll('code');
	</script>
	<!-- End WordPress Code Snippet -->
	<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.yaduk.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.yaduk.co.uk/2009/04/26/interactive-batch-file-with-debug-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
