Auto-execute command after going to a folder with the CD command

Posted by Patrick on Super User See other posts from Super User or by Patrick
Published on 2010-03-11T10:31:06Z Indexed on 2010/03/11 20:14 UTC
Read the original article Hit count: 668

Is it possible to auto-execute a command in a folder if you move to it via the cd command?

Of course I can define my own command (e.g. CHD.BAT) doing something like this:

@echo off
cd %1
if exist init.bat (
    init.bat
) else (
    color 0F
    title Command Prompt
)

But I wonder if something like this would be possible using the standard CD command.

© Super User or respective owner

Related posts about Windows

Related posts about cmd