git console: changing brach interactively

Some time ago I wrote about some helpful script that let me copy branch name without mouse. Later on I wrote about some simple console menu in Powershell. The second one seems to be a far better option here. Here’s the code:

#uncomment if you don't have ps-menu (powershellget is needed)
#install-module ps-menu -scope currentuser

$selection = menu (iex "git branch")
if ($selection -ne $null)
    $branch = $selection.Trim(" ", "*")
    iex "git checkout $branch"

Here is how it works:



Console aliases in Windows – the better approach

A big advantage of working in console mode is ability to create aliases. First you can easily shorten a command with a lot of switches. You can also automate your job by creating a script file and then set an alias for that script.

The default way of creating aliases in Windows is DOSKEY:

doskey np=notepad++.exe $*

The weak point of it is that you have to reassign them after restarting console window. There are ways for automating that using cmd.exe /k switch or using system
registry (see both article and comments).

There is also a buil-in option for ConEmu:

But all in all this is weak, as always you have to do two things: establish an
alias and then save it in some file for future use.

Alternative (better!) solution

I can sell you my way of dealing with aliases. I don’t use DOSKEY. Instead, I have a folder, i.e. C:\Tools\Aliases and there. I have a lot of *.cmd or *.ps1 files. The trick is that the folder is in my PATH variable.
Let’s say I have there a !notes.cmd command that runs:

vim c:\documents\notes01.txt

Then I can type ‘!notes’ and it runs “!notes.cmd” file that results in openning my temporary notes file. Obviously TAB autocompletion works fine. ‘!’ in the beginning lets me filter out my own aliases. I have also “!editaliases.cmd” for editing my aliases:

vim c:\tools\aliases\

Aliases are ready to use just after adding/editing them.
Other advantages:

  • no fancy escape characters (doskey defines its own list)
  • I can assing a whole script to an alias with one file
  • works in every console and emulator

Circular-style TAB behaviour in Cmder (like in cmd.exe)

For a long time I was addicted to ConEmu terminal-replacement. Nowadays I use
amazing cmder that is simply preconfigured Conemu + extensions. Nevertheless there is one very annoying thing that I didn’t like: TAB behavior. Instead of
simple circular-style autocompletion (like in cmd.exe) it stopped on the last
common character and then showed the list of matches (like in Linux).
It turned out that it is all because of clink – one of ConEmu’s extensions. As
it is very customizable, you can easily override it to behave just like in
the default Windows terminal. Authors predicted that and the configuration is already there, ready to uncomment.

In order to do that:
1. Find \vendor\clink folder in CMDER installation path
2. Open clink_inputrc_base file for editing
3. Uncomment lines 67 & 68 as following


Powershell, tools

Simple interactive console menu in Powershell

Personally I am a kind of console-freak. If possible, I would do everything in terminal. But in my case loving terminal is not about remembering all the different switches and options of console commands, but rather presenting things in a simple, readable manner, without fireworks. And most of all, navigation must be fast and comfortable. That’s why I prefer choosing options from simple menu than getting through command documentation and juggling with switches/parameters. That’s the course set out by yeoman for example.

I tried to find an easy way of building command-line menus but I couldn’t so I ended up with my own solution. It’s based on Powershell. I’m sharing it here in case you wanted to use it as well.

As we all know a picture is worth a thousand words:

You can still find the code on github:

The script is really short but the best way you can use it is to install it
with PowerShellGet from

install-module -name ps-menu

You can also copy-paste the code from ps-menu.psm1 file in case you wanted to have everything in one place.