Search code examples
user-profilecmder

cmder ~ alias for user home folder


Simple question :

I am using cmder and i would like to be able to define ~(or ~USERID) as my %USERPROFILE% environment variables. I edited %CMDERROOT%\config\aliases to add this line : ~=%USERPROFILE% it does work for ls command but not for cd for instance.

Is there a better way to have this unix-like user profile aliases ?


Solution

  • For those who would like an answer to that question, it have been addressed in the following github issue :

    https://github.com/cmderdev/cmder/issues/41

    Not a direct answer, but a decent work-around was mentioned in the discussion on that page:

    clink, the vendor package that would handle this has a similar issue report marked as "wontfix" So, here's the workaround

    I'm using an AutoHotKey script for that:

    #IfWinActive ahk_class VirtualConsoleClass
    ::~::D:/nicolas
    #IfWinActive
    

    It replaces automatically ~ with D:/nicolas in ConEmu console (and only ConEmu console)

    I have not tried it in a script executed from the command line, but it works from the command line directly, as nicolas suggests.