Tip: CLI to PowerShell

If you have PowerShell installed (and if you don’t what are you waiting for?) you may be used to starting PowerShell from the Start Menu shortcut. But that’s not the only way.  If you’re like me and always have a command prompt window open, you can easily launch PowerShell simply by running the command: powershell.

That’s great but not good enough for me.  I want visual cues that I now have a PowerShell session open.

I can achieve this by setting the command prompt window’s color and title by using the COLOR and TITLE commands. I can make the changes and start PowerShell with a single command which I’ve put in a batch file I call posh.bat.

@echo off
title Microsoft Windows Powershell && color 9f && powershell -nologo & color && title Command Prompt

At a command prompt, when I run posh.bat the windows changes to a blue background with white text and the title bar changes to Microsoft Windows Powershell. You’ve probably noticed the Color and Title commands at the end of the expression.  When I’m finished with PowerShell and type exit, these commands are run and returns my command prompt to its original state.

Now you can save a few clicks and keystrokes and quickly get to work in PowerShell.