Previous Posts


Elevate processes from the command prompt in Vista...

Connect Using Dialup Modem - Disabled (Why?)

Set default settings for Excel 2003

Update the Windows Path Completion feature

Set the default font in Microsoft Word XP, 2003, a...

Windows Vista User Account Control (UAC)

Schedule a reboot in Windows 2003

Download free hard drive imaging software

Set default folder for attachments in Outlook 2003...

FTP Files Automatically



Archives

May 2005

January 2006

April 2006

May 2006

June 2006

July 2006

September 2006

October 2006

November 2006

December 2006

January 2007

February 2007

March 2007

April 2007

May 2007

June 2007

July 2007

August 2007

September 2007

October 2007

November 2007

December 2007

January 2008

February 2008

March 2008

April 2008

May 2008



Subscribe to our Feed:






AutoRun for the Command Prompt

When I was looking at the documentation for the registry and keys associated with the command processor I came across this:


Command Processor AutoRun Registry Key


Hmm. For the fun of it I opened up the key and put 'notepad.exe' in the AutoRun value.(To see how this actually worked)


Command Processor Auto Run


Any time I opened a console application, or a command prompt window notepad would launch - and the command processor would not start until it was closed. This includes the users login script.

So. This means whatever program I put in this key will execute, and the command processor will wait for it to finish before continuing.

This is perfect for something I was trying to do a few months back. I wanted to dynamically set a few environment variables - and have them available to any console based application. I tried putting it in the logon script, but that didn't work since the environment variables only lasted for that session.

I ended up using the CALL command within each batch file I had. This was difficult because the batch files were part of an aging third party application - There were hundreds of them. Also some of them were automatically generated from time to time by the application, so the solution was not perfect.

I went back and setup my "set environment variables" batch file in the AutoRun key of the registry (Side note - make sure you put quotes around the full path of the filename in this key...or it will get lost on the first space it sees).

Then I removed my added call commands. Now when I ran any command prompt my custom environment variable script executed dutifully.

Better yet, since it is a registry key I was able to write a quick login script that updated all the clients on the network with the new setting.

I am not sure how often most administrators will need to use this registry key, since usually a login script will work for what you need. Still - the AutoRun key for the command prompt has its purpose. Now that you know it is there you have the option to use it when needed.


Posted By: Steve Wiseman on Sunday, September 23, 2007

Check out our utilities for windows

 



Copyright © IntelliAdmin, LLC, 2008. All Rights Reserved