10/9/2017 - 9:09 AM

Windows Cmd .bashrc Equivalent

Equivalent to the .bashrc file in Unix. Use this to setup global aliases and VARs. In Windows you'll need to do some extra work so it is loaded for every cmd process:

In regedit.exe, goto "HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor". If the String Value 'AutoRun' does not yet exist, create it and set the value to the path of your script.

@echo off
REM Set's aliases and VARs
REM Just like the .bashrc file in Unix
REM Needs to run on every start of the cmd process

REM Put stuff you want for every command process here:

echo %USERNAME%: Done loading command '.bashrc' equivalent from "%~f0"
@echo on