Edit: this post was written before the release of PSReadLine which seems to be a more reasonable choice than PowerTab for powershell.exe enhancement (completion, intellisense etc.). Indeed, this latter project looks like to be dead now and does not seem to be as rich as the former one. Regarding the rest of the post below, I encourage you to use Conemu console which is still far better than the usual CommandPrompt (this may change with the release of Win10). In addition, you may skip the “Aliasing part” because command in PATH are well recognized by PSReadLine which was not the case for PowerTab. You will discover also a lot of interesting features proposed by PsReadLine such as syntax coloring, custom key bindings….

Microsoft has released in 2006 Powershell (PoSh), a brilliant shell based on the .NET framework. However, the console (or terminal) stays really close to the usual windows command prompt. It is commonly admitted that this console suffers a lot of drawbacks which makes it painful for a everyday usage, see for example these blogs (artlogic , hanselman, etc.). Just to make things clear, let us recall the difference between a shell and a console. The former is the command interpreter, it is performing the hard work while the latter is just the window, i.e. the program in charge of prompting and displaying information.

ConEmu with PowerTab tabbing
ConEmu with PowerTab tabbing

In this post I will show you how to configure ConEmu an opensource console emulator to work with Powershell and to benefit from a well designed tab completion with PowerTab.

We will only refer to the latest version of Powershell, the 3.0 released in 2012. Let us mention that Powershell 3.0 came with a new version of Powershel ISE, the PoSh scripting environment. In this third version, ISE has Intellisense which is a great feature, especially when you are discovering PoSh. Unfortunately, ISE console does not support tabbing and suffers the same drawbacks has the original windows command prompt. In addition, ISE is perfectly suited when you are writing some script but is not really adapted to perform every day tasks. In one word ISE more an IDE than a console. In order to have a substitute to Intellisense in ConEmu we will use the PowerTab project.

You may start right now by checking that you have Powershell 3.0 installed (how to check version). Right after, you may start downloading ConEmu.

If you are an intensive Powershell user, you would want ConEmu to start directly with a new PoSh session. Nothing is more simple, just add the following .txt file somewhere in your disk (e.g. next to ConEmu .exe file).

Target in properties of the desktop/taskbar shortcut
Target in properties of the desktop/taskbar shortcut

Next, create a shortcut in task bar or desktop, right click on it on go to the properties of  the link. You may enter the following command in the target property:  <pathToConemu>conemu.exe /cmd @ <pathtoyourfile>/startfile.txt

So now you would have a nice console which starts automatically with Powershell. Let us go a little bit further by importing PowerTab in ConEmu. Visit PowerTab website and download the sources rather than the packaged version. Indeed, many fixes are present in the source code but not packaged in the .zip. At the time of the writing I use version of commit 035310b4c93e, Follow the instruction for installing Powertab. Quickly it is: unzipping source under <YourHomePath>/WindowsPowerShell/Modules/PowerTab and execute command Import-Module PowerTab.

While importing PowerTab module, it will ask you if you want to import PowerTab on start. This config will be saved by updating your $PROFILE. If your not familiar with PoSh profiles now, I suggest you to read this. To sum up the $PROFILE is a special PoSh script executed each time your entering a new Powershell session (then each time you are starting ConEmu if you have done what is above). This is where you would put some custom scripts and any in-house configuration. NB: under commit 035310b4c93e, the function of your $PROFILE are recognized by PowerTab which does not seemed to be the case on the packaged version PowerTab 0.99.6.

Now we do have a console with efficient tabbing. The style is much more old school than the ISE intellisense but it does the job well and is quite pleasant to use.

I am not done yet, actually, our version of PowerTab does not see the .exe in you PATH environment variable for tabbing. This is quite frustrating not to have auto-complete for vim, notepad++, tracecrt.exe etc. This may be included in incoming version (I will see what I can do…) but here is workaround. As long as PowerTab recognizes Powershell command aliases, we are going to build an alias dictionary that includes the aforementioned .exe located in the PATH environment variable.

The following snippet shows a part of your $PROFILE where the aliases are imported just before the module PowerTab. They are imported from a file alias.txt which is located next to the $PROFILE .ps1 file. You create this alias.txt file by invoking the function Export-AliasWithEXEInPATH. You have to call this function at least once and to keep your aliases up-to-date you should run it when you modify the PATH variable. Remark the lightweight PoSh syntax for the .NET hashtable: @{}

Even if it will probably be outdated soon, this is my configuration at home and at work for now and I am quite pleased of it.