About
When Cmd starts, if /D is NOT specified on the command line, then it looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if either or both are present, they are executed first.
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
and/or
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
Articles Related
Example
In the below autorun variable, I will change the current directory to D:\myBat