Automatically run a batch file when you open a Windows
XP command prompt.
You probably run the same few commands each time you
start using the command prompt in Windows XP. For example, perhaps you first
switch to the root directory and then clear the screen. Then, you may have put
these commands into a batch file and saved the file to the C:\Documents and
Settings\{username} folder so that when you open the command prompt, you
simply type the name of the batch file to issue the commands.
You can save yourself from typing any commands at all if
you add the path and name of the batch file to a special key in the registry.
Here’s how to add them:
1. Launch the Registry Editor (Regedit.exe).
2. Go to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command
Processor key.
3. Double-click the AutoRun value to access the Edit
String dialog box.
4. In the Value Data text box, type the path and name of
the batch file. Be sure to enclose the text in double quotes — for example,
“C:\Documents and Settings\gary\go.bat”.
5. Click OK to close the Edit String dialog box and
close the Registry Editor.
Now, your batch file will automatically run every time
you open the command prompt window.
Caution: Editing the
registry is risky, so make sure you have a verified backup before making any
changes.
Note: Both
Windows XP Home and Professional.