When you use command-line tools, you must customize certain environmental elements every time you open a new command prompt. You'll often be working in the same directory each time you need to apply a particular set of customizations, so having an automatic method for applying customizations would be handy. The registry tweak InitHere is a simple modification of the CMD Prompt Here PowerToy that lets you easily make such changes automatically.
To install the InitHere PowerToy, right-click InitHere.inf, which Listing 1 shows, and select Install from the context menu. After you install the PowerToy, you'll have a new context menu choice for InitHere when you select a folder. Selecting InitHere automatically opens a command prompt in the folder. InitHere also looks for a file named init.cmd in the folder; if the file exists, the commands in the file will execute immediately. To illustrate some of InitHere's conveniences, the example INIT.cmd script in Listing 2 sets the console's color, customizes the screen, temporarily adds a directory to the path, echoes some potentially important reminder information for the session, then switches to another working directory.
If you simply want to run a script every time you open a command prompt, you can use an even easier method. The HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor and HKEY_CURRENT_USER\Software\Microsoft\Command Processor registry subkeys support an AutoRun REG_SZ value into which you can insert the full path to the script or executable you want to run when the console session starts.