0

I'd like use ~ as user home, %USERPROFILE% is too long.

But I don't know where to set this alias/mapping, since windows cmd not support alias, I am afraid ConEmu can not do this.

1 Answer 1

0

False. cmd.exe support aliases. Moreover, ConEmu provides easy way to setup them.

So you may define in ConEmu Environment:

alias ~=cd /d "%USERPROFILE%"

And after that you may execute in cmd.exe prompt:

D:\Sources> ~
C:\Users\Max>

Or you may create an alias for cd~ to make it more natural:

alias cd~=cd /d "%USERPROFILE%"

And execute it

D:\Sources> cd~
C:\Users\Max>
3
  • This looks like it answers the OP's question about an alias, but does not indicate typical ~ = home usage. Is there a way to make "echo ~" provide the same output as "echo %USERPROFILE%"?
    – TOOGAM
    Commented Jul 13, 2017 at 9:14
  • You may define alias for echo~.
    – Maximus
    Commented Jul 13, 2017 at 13:13
  • That still doesn't treat ~ like %USERPROFILE%. I know this answer seems to directly address the OP's comment about aliases, but I don't see this answer as really answering the core question. For instance, I can say: "copy filename %USERPROFILE%\Downloads". I don't see how your approach could let me say "copy filename ~\Downloads". The "echo ~" was just one simple example that is an easy way to suitably test this flexibility, and your idea there doesn't provide that sought-after flexibility at all. I don't seek to discourage: If there's an available solution, it'd be nice to know
    – TOOGAM
    Commented Jul 13, 2017 at 14:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .