Run commands automatically at command prompt start

When opening a command prompt (cmd.exe) console, then it checks the following STRING values in the registry to see if any commands should be executed:

[HKEY_CURRENT_USER \SOFTWARE \Microsoft \Command Processor]
[HKEY_LOCAL_MACHINE \SOFTWARE \Microsoft \Command Processor]
Autorun = "prompt [%computername%]$S$P$G && COLOR 0A && CD C:\"

Note the commands above will change the command prompt and color and change the default path/directory when opening the command prompt to the root of the C-drive.

Note to specify several commands separate them with &&, or use a batch file like a Autoexec.bat.

Note the cmd has a switch to disable the execution of the Autorun:

cmd /d



  1. Adi says:

    As useful as this is, it screwed up my build system and it took me a LOT of time to figure that this was the culprit.

    If your build systems spawn off new cmd's internally to execute any processes, and God forbid if they use relative paths, changing your default root screws things up.

Leave a Reply

Your email address will not be published. Required fields are marked *