News, Product Information, and Tips
Check out our free utlities in the downloads section

Remote Administration



Remote Administration For Windows. Easy remote access of Windows 7, XP, 2008, 2000, and Vista Computers

Click here to find out more

Create Outlook Profiles



No more setup wizards in Outlook. Setup Outlook Profiles automatically from the command line

Click here to find out more

Network Administrator



Reboot Hundreds of computers, disable flash drives, deploy power managements settings.

Click here to get your free copy of Network Administrator. Over 25 plugins to make your life easier

USB Disabler



Disable Flash Drives for specific users, or only allow specific drives.

Click here for your free trial

Search

Archives

AutoRun for the Command Prompt

by Steve Wiseman on September 24, 2007 · 0 comments

in Windows

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.

Like this article? Then sign up for my newsletter to get free tips and software sent right to your inbox once a week. Like you, I hate spam – I will never spam, or sell your email address.

Related Articles:

Leave a Comment

Category Links - Windows Forum - Exchange Forum