<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Bobobobo's Weblog &#187; shell</title>
	<atom:link href="http://bobobobo.wordpress.com/category/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://bobobobo.wordpress.com</link>
	<description>technology and the internets</description>
	<lastBuildDate>Mon, 30 Nov 2009 16:56:23 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='bobobobo.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/0e8d17c68f90a18a1e89a776717e00e2?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Bobobobo's Weblog &#187; shell</title>
		<link>http://bobobobo.wordpress.com</link>
	</image>
			<item>
		<title>Windows shell scripting</title>
		<link>http://bobobobo.wordpress.com/2008/12/27/windows-shell-scripting/</link>
		<comments>http://bobobobo.wordpress.com/2008/12/27/windows-shell-scripting/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 20:17:10 +0000</pubDate>
		<dc:creator>bobobobo</dc:creator>
				<category><![CDATA[shell]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://bobobobo.wordpress.com/?p=517</guid>
		<description><![CDATA[Windows shell scripting
fantastic
The %stuff%
There are several items that you can use that looks like %this%.

%PATH%
%APPDATA%
%DATE%
%TIME%

basically, these %this% is how you access any of the environment variables defined on your system.  Right click My Computer &#62; Properties &#62; Advanced &#62; Environment Variables


Those are all the environment variables on your system.
At CMD:


C:\&#62; echo %APPDATA%


HKLM local machine [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bobobobo.wordpress.com&blog=2331964&post=517&subd=bobobobo&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h1>Windows shell scripting</h1>
<p><a href="http://www.jpsdomain.org/windows/winshell.html">fantastic</a></p>
<h3>The %stuff%</h3>
<p>There are several items that you can use that looks like %this%.</p>
<ul>
<li>%PATH%</li>
<li>%APPDATA%</li>
<li>%DATE%</li>
<li>%TIME%</li>
</ul>
<p>basically, these %this% is how you access any of the environment variables defined on your system.  Right click My Computer &gt; Properties &gt; Advanced &gt; Environment Variables</p>
<p><img src="http://bobobobo.files.wordpress.com/2008/12/env_vars.png" /></p>
<p><img src="http://bobobobo.files.wordpress.com/2008/12/env_vars2.png" /></p>
<p>Those are all the environment variables on your system.</p>
<p>At CMD:</p>
<blockquote>
<pre>
C:\&gt; echo %APPDATA%
</pre>
</blockquote>
<p>HKLM local machine variables (bottom half) supercede current user variables (top half).  Well, if you have a PATH variable defined as both HKLM and HKCU then if you <kbd>echo %PATH%</kbd> it gives you the HKLM machine variable; CONTENATE HKCU variable</p>
<p>Substring:  %VAR:offset,len%</p>
<p>e.g.</p>
<blockquote>
<pre>
echo %DATE:~1,2%    REM If its Dec, gives ec.  Starting at position 1, get 2 chars
echo %DATE:~1%      REM Goes from position 1 to end of string.  ec 27 08
</pre>
</blockquote>
<p>Above example not that useful, but at least its clear how to work it</p>
<h3>Getting random user input.</h3>
<p>Try putting this into test.bat, then running it:</p>
<blockquote>
<pre>
set /P MyAnswer=Tell me something: 

echo You said: "%MyAnswer%"

pause
</pre>
</blockquote>
<p>Thanks to <a href="http://www.jpsdomain.org/windows/winshell.html">this guy again</a> for that neat tip!</p>
Posted in shell, windows  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bobobobo.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bobobobo.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bobobobo.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bobobobo.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bobobobo.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bobobobo.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bobobobo.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bobobobo.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bobobobo.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bobobobo.wordpress.com/517/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bobobobo.wordpress.com&blog=2331964&post=517&subd=bobobobo&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://bobobobo.wordpress.com/2008/12/27/windows-shell-scripting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a4ec51727310397c9e592dd84ae74dc2?s=96&#38;d=http%3A%2F%2Fa.wordpress.com%2Fi%2Fmu.gif" medium="image">
			<media:title type="html">bobobobo</media:title>
		</media:content>

		<media:content url="http://bobobobo.files.wordpress.com/2008/12/env_vars.png" medium="image" />

		<media:content url="http://bobobobo.files.wordpress.com/2008/12/env_vars2.png" medium="image" />
	</item>
	</channel>
</rss>