DEV Community

Saurabh Sharma
Saurabh Sharma

Posted on

What can you do with Powershell (for developers) โš”๐Ÿ’

HERO

Normally developers talk about how much productive you can become by using command line tools but the sad thing is they always talk about iTerm or BASH may be ZSH but what about windows users. I know that command line in windows sucks but there is still some hope, here we have Powershell. Powershell has most of the commands like curl and ls (they work in windows style).

I decided to see how far I can go with Powershell and there is what I came up with.

PowerShell is Customizable ๐Ÿค“

You can change the prompt of PowerShell with different colors, many outputs and like all Bash kids, you can also view git statuses with modules like Post-git. If you want to go further and even change the title of the prompts.

Like BASH guys keep their configs in ~/.bashrc we can save our configs in ~\Documents\WindowsPowerShell\profile.ps1

You can remove bells with Set-PSReadlineOption -BellStyle None or import modules like Import-Module posh-git

If you don't like the default prompt C:\Users\jztsaurabh\Documents\WindowsPowerShell> yeah this one, then you can customize it too.

here is how I customized my prompt

that's how it looks with all cool customizations
my powershell pic

Using Modules

If you like to view git status in command line then modules in PowerShell can help you.
You need to install Post-git

You can also install it from PowerShell ๐Ÿ˜œ
Install-Module -Name posh-git -Scope CurrentUser

Some people like to use Z for jumping between nested folder structures.You can install Z for PowerShell too.

just use
Install-Module -Name z -Scope CurrentUser

functions in PowerShell ๐ŸŽ

Making functions are really easy in PowerShell if you want to run a number of commands at once, then functions may help you.
If you want to set-up a new machine you can run functions that can install git, Nodejs, Firefox or other software for you.

I made some functions like:

Aliases (Oh my Aliases ๐Ÿ˜)

Aliases in Powershell are exactly what you expect from it. You can create shortcut commands and create an alias for an executable (they are better than adding everything in Environment variables).

I like to use grep

Scoop for package management ๐Ÿ“ฆ

This is my favorite, I was searching for a package manager for windows like brew, If found chocolaty but it has outdated versions of the atom, and I found scoop it was just what I was looking for, it works, it doesn't need admin permission for installing apps. It just works fine.

You can install [scoop] by

You can use it like

You know what I'm looking for good color schemes ๐Ÿ’ฅ

Ok, we have that too. You can install concfg once you got scoop. It has plenty of color schemes that you will definately enjoy.
here is the monokia colorscheme.

monokai preview

Further reads

stack overflow link of Powershell ps1

link of a good profile.ps1

Powershell gallery

find Powershell configs

My profile.ps1

Top comments (5)

Collapse
 
wplj profile image
wplj

Why is it called 'for developers'? There's nothing for developers in this post (objects, type system, closures support, 'Function' provider etc), just regular user stuff.

Collapse
 
itsbennett profile image
Bennett Mouton

this is incredible!! thank you so much for this information!

Collapse
 
johndoesup profile image
abhishek

saurabh amazing i'm windows user and I use powershell every day but hate it's native look, is there a way to add emoji to powershell. If so how to do it.

Collapse
 
itsjzt profile image
Saurabh Sharma • Edited

Actually, I didn't get any. They also create problems even when you try to put them in write-host. If you just want to view emojis in some commit messages, then hyper may help you. (hyper.is)

Collapse
 
iglesk profile image
Omar AlSabek

This is totally incredible!! Thanks for sharing!