3

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 ?

anchnk
  • 291
  • 1
  • 5
  • 19
  • Unfortunately, I did but it doesn't work, however I found some answers in project's github issues – anchnk Nov 30 '15 at 14:14

2 Answers2

2

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.

TecBrat
  • 3,643
  • 3
  • 28
  • 45
anchnk
  • 291
  • 1
  • 5
  • 19
1

I don´t remember where I got it but add these lines to your profile:

function cuserprofile { Set-Location ~ }
Set-Alias ~ cuserprofile -Option AllScope

you just hit ~ (enter) and you'll send to your home directory.

PS. I'm using PowerShell in cmder, regards.

IngeTecGDL
  • 11
  • 1