<?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>VariableGHz &#187; batch script</title>
	<atom:link href="http://variableghz.com/tag/batch-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://variableghz.com</link>
	<description>For the technically inclined.</description>
	<lastBuildDate>Thu, 19 Jan 2012 22:26:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Why I Still Use DOS</title>
		<link>http://variableghz.com/2008/11/why-i-still-use-dos/</link>
		<comments>http://variableghz.com/2008/11/why-i-still-use-dos/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 09:03:25 +0000</pubDate>
		<dc:creator>Samuel</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[batch script]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[dos]]></category>
		<category><![CDATA[vghz-use-dos]]></category>
		<category><![CDATA[why-use-dos]]></category>
		<category><![CDATA[xcopy]]></category>

		<guid isPermaLink="false">http://variableghz.com/?p=158</guid>
		<description><![CDATA[For some of you, the thought of DOS probably brings back horrifying memories of things like IRQ conflicts, MSCDEX, the config.sys, himem.sys, etc. Those days are over, but the best aspects of DOS remain a part of Windows, fortunately. Knowledge of DOS has been critical to my geeky endeavors over the last dozen or so [...]]]></description>
			<content:encoded><![CDATA[<p>For some of you, the thought of DOS probably brings back horrifying memories of things like IRQ conflicts, <a href="http://support.microsoft.com/kb/87165">MSCDEX</a>, the <a href="http://www.onecomputerguy.com/install/configsys.htm">config.sys</a>, <a href="http://www.pcmag.com/encyclopedia_term/0,2542,t=DOS+HIMEMSYS&amp;i=41811,00.asp">himem.sys</a>, etc. Those days are over, but the best aspects of DOS remain a part of Windows, fortunately.</p>
<p>Knowledge of DOS has been critical to my geeky endeavors over the last dozen or so years. Back in the nineties, as the GUI became pervasive and people seemed to have completely forgotten the command-line altogether, I continued to use it for a wide range of tasks. Yes, part of the reason I haven&#8217;t &#8220;let go&#8221; of DOS is in part nostalgic. The other part is that it has in fact been and remains very useful. Especially in troubleshooting and fixing low level problems that can&#8217;t be solved any other way.</p>
<p>So, you&#8217;re wondering what I could possibly have used DOS to accomplish? These days, for most things DOS can do, there is usually a free or paid application for Windows that does the same thing a little easier. Thing is, knowing how to do various tasks in DOS can help you repair Windows and perform a whole host of other tasks a lot quicker and often more efficiently than installing a bunch of different programs.</p>
<p><span id="more-158"></span></p>
<p>As a visual effects artist, I usually render out very large .tga sequences. From time to time, somebody will set the render options incorrectly and I will end up with a bunch of files that are missing an extension. So, if I called the sequence WalkSequence[####], the extension will be missing from some mistake in the render options. I could download a program that will automatically rename large groups of files for me, like the <a href="http://www.bulkrenameutility.co.uk/Download.php">Bulk Rename Utility</a> (direct download, <a href="http://variableghz.com/wp-content/uploads/2008/11/bru_setup_winntx86.exe">x86</a>, <a href="http://variableghz.com/wp-content/uploads/2008/11/bru_setup_winntx64.exe">x64</a>); or <a href="http://www.winautomation.com/download.html">winautomation</a> which is not freeware. You could also highlight all the files in <a href="http://www.mydigitallife.info/2007/05/12/how-to-rename-multiple-or-a-series-of-files-in-windows-vista/">Explorer</a> and hit F2, rename the first file and then hit enter, however I don&#8217;t prefer this method.</p>
<p>What I do, is just use the DOS command <strong>REN</strong> or <strong>RENAME</strong>. With any DOS command, to learn the parameters and flags, just type the command and then <strong>/?</strong> after it. So, for <strong>REN</strong>, we&#8217;d type it like this:</p>
<p style="text-align: center;"><a href="http://variableghz.com/wp-content/uploads/2008/11/renhelp.jpg"><img class="aligncenter size-full wp-image-163" style="border: 2px solid black;" title="renhelp" src="http://variableghz.com/wp-content/uploads/2008/11/renhelp.jpg" alt="" width="500" height="126" /></a></p>
<p style="text-align: center;"><strong>REN /?</strong></p>
<p>So, let&#8217;s say I had 1,000 files missing an extension. I&#8217;d type <strong>REN</strong> then the first filename followed by a wildcard (an asterisk in DOS) to indicate <em>anything after</em> then the new filename, and with the addition of the extension you want. DOS would then cycle through every single file matching the properties you defined, which is where the wildcards help. Like this:</p>
<p><strong>REN WalkSequence* WalkSequence*.TGA</strong></p>
<p>&#8230;which would turn your filenames into WalkSequence0001.tga and so on &#8212; and if you wanted to change .TGA to, say, .JPG, you would type it out like this:</p>
<p><strong>REN WalkSequence*.TGA WalkSequence*.JPG</strong></p>
<p>That&#8217;s it. When you type the command in DOS and hit enter, you won&#8217;t see any feedback, but the command will work. Some DOS commands issue feedback, some don&#8217;t.</p>
<p><span style="text-decoration: underline;">XCOPY</span></p>
<p>Old folks don&#8217;t like launching applications like <a href="http://www.acronis.com/homecomputing/">Acronis TrueImage</a> and <a href="http://www.itefix.no/i2/node/10650">cwrsync</a>. The XCOPY command has a tremendous amount of flags so it can be daunting to some folks. Don&#8217;t worry about it, as with any command, just step through the flags slowly and make it work for what you&#8217;re doing. The reason why I mention Acronis TrueImage and cwrsync, is because those are a couple of my favorite backup applications that I frequently use for law firms and computers in the home. Thing is, old folks forget to open seemingly complex programs like TrueImage and having to click buttons. They shut down the computers by accident, ruining my scheduled tasks, etc. So, my solution? XCOPY.</p>
<p>I need something as simple that (1) backs up the computer without any prompts whatsoever to confuse my computer illiterate clients; (2) be executed with a simple double-click; and (3) shuts down the computer when it&#8217;s all done.</p>
<p>XCOPY to the rescue. XCOPY allows me to do all of the above using a simple batch script. Let&#8217;s say I want to back up the Program Files directory to an external hard drive. The batch script I write would look something like this (E: is the external drive):</p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>ECHO OFF<br />
CLS<br />
VERIFY ON</strong></span></p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>XCOPY C:\PROGRA~1\*.* /E /I /V /C /F /R /K /X /Y E:\</strong></span></p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>SHUTDOWN -S -C &#8220;Press ANY KEY in the COMMAND LINE WINDOW to ABORT THE SHUT DOWN PROCEDURE. Otherwise: This system WILL SHUT DOWN IN TWO MINUTES.&#8221; -T 120 -F </strong></span></p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>PAUSE<br />
SHUTDOWN -A</strong></span></p>
<p>Note: On Vista, the hyphen is no longer used and has been replaced with a forward slash. So, instead of <strong>SHUTDOWN -A</strong>, you&#8217;d type <strong>SHUTDOWN /A</strong>. I don&#8217;t know why Microsoft changed this.</p>
<p>Stepping through the flags individually, it isn&#8217;t as complex as it looks:</p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>/E</strong></span> -Copies directories and subdirectories, including empty ones.</p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>/I</strong></span> &#8211; If destination does not exist and copying more than one file, assumes that destination must be a directory.</p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>/V</strong></span> &#8211; Verifies the size of each new file.</p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>/C</strong></span> &#8211; Continues copying even if errors occur.</p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>/F</strong></span> &#8211; Displays full source and destination file names while copying.</p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>/R</strong></span> &#8211; Overwrites read-only files.</p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>/K</strong></span> &#8211; Copies attributes. Normal Xcopy will reset read-only attributes.</p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>/X</strong></span> &#8211; Copies file audit settings (implies /O).</p>
<p style="padding-left: 30px;"><span style="color: #00ff00;"><strong>/Y</strong></span> &#8211; Suppresses prompting to confirm you want to overwrite an existing destination file.</p>
<p>Notice how the flags, when combined, allow me to create the perfect execution of settings thereby permitting me to do exactly what I want, without any extra programs or complexities for my clients. All it takes is <strong>/?</strong>ing the commands to figure out how they work and tailoring them to your specific needs.</p>
<p>In future posts I will outline more specific examples of various commands and how they help me perform seemingly complex tasks in the Windows Recovery Console (such as <a href="http://pcsupport.about.com/od/termsf/p/fixmbr.htm">FIXMBR</a>, <a href="http://pcsupport.about.com/od/termsd/p/diskpart.htm">DISKPART</a>, etc.) and <a href="http://www.computerhope.com/overview.htm">others</a>.</p>
<p><a href="javascript:DeCryptX('benjoAwbsjbcmfhi{/dpn')">&#97;d&#109;&#105;n&#64;v&#97;&#114;ia&#98;l&#101;g&#104;&#122;&#46;&#99;o&#109;</a><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://variableghz.com/2008/11/why-i-still-use-dos/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://www.shareaholic.com/api/share/?title=Why+I+Still+Use+DOS&amp;link=http://variableghz.com/2008/11/why-i-still-use-dos/&amp;notes=For%20some%20of%20you%2C%20the%20thought%20of%20DOS%20probably%20brings%20back%20horrifying%20memories%20of%20things%20like%20IRQ%20conflicts%2C%20MSCDEX%2C%20the%20config.sys%2C%20himem.sys%2C%20etc.%20Those%20days%20are%20over%2C%20but%20the%20best%20aspects%20of%20DOS%20remain%20a%20part%20of%20Windows%2C%20fortunately.%0D%0A%0D%0AKnowledge%20of%20DOS%20has%20been%20critical%20to%20my%20geeky%20endeavors%20over%20&amp;short_link=&amp;shortener=b2l&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://www.shareaholic.com/api/share/?title=Why+I+Still+Use+DOS&amp;link=http://variableghz.com/2008/11/why-i-still-use-dos/&amp;notes=For%20some%20of%20you%2C%20the%20thought%20of%20DOS%20probably%20brings%20back%20horrifying%20memories%20of%20things%20like%20IRQ%20conflicts%2C%20MSCDEX%2C%20the%20config.sys%2C%20himem.sys%2C%20etc.%20Those%20days%20are%20over%2C%20but%20the%20best%20aspects%20of%20DOS%20remain%20a%20part%20of%20Windows%2C%20fortunately.%0D%0A%0D%0AKnowledge%20of%20DOS%20has%20been%20critical%20to%20my%20geeky%20endeavors%20over%20&amp;short_link=&amp;shortener=b2l&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.shareaholic.com/api/share/?title=Why+I+Still+Use+DOS&amp;link=http://variableghz.com/2008/11/why-i-still-use-dos/&amp;notes=For%20some%20of%20you%2C%20the%20thought%20of%20DOS%20probably%20brings%20back%20horrifying%20memories%20of%20things%20like%20IRQ%20conflicts%2C%20MSCDEX%2C%20the%20config.sys%2C%20himem.sys%2C%20etc.%20Those%20days%20are%20over%2C%20but%20the%20best%20aspects%20of%20DOS%20remain%20a%20part%20of%20Windows%2C%20fortunately.%0D%0A%0D%0AKnowledge%20of%20DOS%20has%20been%20critical%20to%20my%20geeky%20endeavors%20over%20&amp;short_link=&amp;shortener=b2l&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.shareaholic.com/api/share/?title=Why+I+Still+Use+DOS&amp;link=http://variableghz.com/2008/11/why-i-still-use-dos/&amp;notes=For%20some%20of%20you%2C%20the%20thought%20of%20DOS%20probably%20brings%20back%20horrifying%20memories%20of%20things%20like%20IRQ%20conflicts%2C%20MSCDEX%2C%20the%20config.sys%2C%20himem.sys%2C%20etc.%20Those%20days%20are%20over%2C%20but%20the%20best%20aspects%20of%20DOS%20remain%20a%20part%20of%20Windows%2C%20fortunately.%0D%0A%0D%0AKnowledge%20of%20DOS%20has%20been%20critical%20to%20my%20geeky%20endeavors%20over%20&amp;short_link=&amp;shortener=b2l&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://www.shareaholic.com/api/share/?title=Why+I+Still+Use+DOS&amp;link=http://variableghz.com/2008/11/why-i-still-use-dos/&amp;notes=For%20some%20of%20you%2C%20the%20thought%20of%20DOS%20probably%20brings%20back%20horrifying%20memories%20of%20things%20like%20IRQ%20conflicts%2C%20MSCDEX%2C%20the%20config.sys%2C%20himem.sys%2C%20etc.%20Those%20days%20are%20over%2C%20but%20the%20best%20aspects%20of%20DOS%20remain%20a%20part%20of%20Windows%2C%20fortunately.%0D%0A%0D%0AKnowledge%20of%20DOS%20has%20been%20critical%20to%20my%20geeky%20endeavors%20over%20&amp;short_link=&amp;shortener=b2l&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.shareaholic.com/api/share/?title=Why+I+Still+Use+DOS&amp;link=http://variableghz.com/2008/11/why-i-still-use-dos/&amp;notes=For%20some%20of%20you%2C%20the%20thought%20of%20DOS%20probably%20brings%20back%20horrifying%20memories%20of%20things%20like%20IRQ%20conflicts%2C%20MSCDEX%2C%20the%20config.sys%2C%20himem.sys%2C%20etc.%20Those%20days%20are%20over%2C%20but%20the%20best%20aspects%20of%20DOS%20remain%20a%20part%20of%20Windows%2C%20fortunately.%0D%0A%0D%0AKnowledge%20of%20DOS%20has%20been%20critical%20to%20my%20geeky%20endeavors%20over%20&amp;short_link=&amp;shortener=b2l&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=88&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=Why+I+Still+Use+DOS&amp;link=http://variableghz.com/2008/11/why-i-still-use-dos/&amp;notes=For%20some%20of%20you%2C%20the%20thought%20of%20DOS%20probably%20brings%20back%20horrifying%20memories%20of%20things%20like%20IRQ%20conflicts%2C%20MSCDEX%2C%20the%20config.sys%2C%20himem.sys%2C%20etc.%20Those%20days%20are%20over%2C%20but%20the%20best%20aspects%20of%20DOS%20remain%20a%20part%20of%20Windows%2C%20fortunately.%0D%0A%0D%0AKnowledge%20of%20DOS%20has%20been%20critical%20to%20my%20geeky%20endeavors%20over%20&amp;short_link=&amp;shortener=b2l&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-mail">
			<a href="http://www.shareaholic.com/api/share/?title=Why%20I%20Still%20Use%20DOS&amp;link=http://variableghz.com/2008/11/why-i-still-use-dos/&amp;notes=For%20some%20of%20you%2C%20the%20thought%20of%20DOS%20probably%20brings%20back%20horrifying%20memories%20of%20things%20like%20IRQ%20conflicts%2C%20MSCDEX%2C%20the%20config.sys%2C%20himem.sys%2C%20etc.%20Those%20days%20are%20over%2C%20but%20the%20best%20aspects%20of%20DOS%20remain%20a%20part%20of%20Windows%2C%20fortunately.%0D%0A%0D%0AKnowledge%20of%20DOS%20has%20been%20critical%20to%20my%20geeky%20endeavors%20over%20&amp;short_link=&amp;shortener=b2l&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://variableghz.com/2008/11/why-i-still-use-dos/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

