After Hours

General discussion



By paul ·
Tags: Off Topic
blog root

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Batch Scripts

by paul In reply to paul

<p class="MsoNormal"><span>Before we start on making batch files to install our applications and registry tweaks, you may want to find out what they do and to see how they are used:<br /><br />Batch files (*.cmd or *.bat, although *.cmd is recommended) can be executed in several areas of Windows XP's Setup process. Using batch files helps to automate several tasks at once without any interaction required. <br /><br />They can be executed from either cmdlines.txt, svcpack.inf, a RunOnceEx entry in the Registry, or from the [GuiRunOnce] section in winnt.sif. You will learn more about these as you go through this issue. </span></p><span>
<p class="MsoNormal"><b><span>Typical contents of a batch file<?xml:namespace prefix =" o" ns =" "urn:schemas-microsoft-com:office:office"" /></span></b></p>
<p class="MsoNormal"><span><br />Batch files supports all the commands that work as if you were using the Command Prompt. To see Windows XP's Command Prompt, go to Start > Run > and type <b>cmd</b> followed by enter.<br /><br />Let's try making a small batch file that does several things. Open Notepad and copy and paste the following: </span></p><pre><span><font size="2">@echo off</font></span></pre><pre><span><font size="2">title Batch File Testing</font></span></pre><pre><span><o><font size="2"> </font></o></span></pre><pre><span><font size="2">echo Hello World</font></span></pre><pre><span><o><font size="2"> </font></o></span></pre><pre><span><font size="2">echo.</font></span></pre><pre><span><font size="2">echo Starting MS Paint</font></span></pre><pre><span><font size="2">start mspaint</font></span></pre><pre><span><o><font size="2"> </font></o></span></pre><pre><span><font size="2">echo.</font></span></pre><pre><span><font size="2">echo Starting Wordpad</font></span></pre><pre><span><font size="2">start Wordpad</font></span></pre><pre><span><o><font size="2"> </font></o></span></pre><pre><span><font size="2">echo.</font></span></pre><pre><span><font size="2">pause</font></span></pre><pre><span><font size="2">exit</font></span></pre>
<p class="MsoNormal"><span><br /><br />Save this as anything you like, as long as it has a .cmd extension. Now double-click on the file. You will find that it renames the Window title to "Batch File Testing", opens MSPaint and Wordpad, asks you to press any key to continue, and then it exits.</span></p>
<p class="MsoNormal" align="center"><span><?xml:namespace prefix =" v" ns =" "urn:schemas-microsoft-com:vml"" /><v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:formulas></v:formulas></v:shapetype><v:shape id="_x0000_i1025" alt="Unattended xpcd" type="#_x0000_t75"></v:shape></span></p>
<p class="MsoNormal"><span><o> </o></span></p>

Related Discussions

Related Forums