While programming all you need is a cup of coffee and Music (and Brain ~Implied 😛) . Well we can’t automate getting the coffee part, but today I’ve made a small script that automatically play random songs for you in background

PURPOSE :

To play Random music from a selection, Automatically when I open my PowerShell console or On demand in Background.

So that you can continue your work and don’t have to worry even changing the Music and let Powershell Manage the music randomly and you can just concentrate on your work.

HOW IT WORKS :

Following image explains the logic and script execution, which is self explanatory.

how_it_works

HOW TO RUN IT :

Playing the Music in background whenever you want like in animation below,

ezgif.com-optimize

Note that script will notify you will a balloon message in System tray whenever a new song is played.

tray

To Stop the music you can simply stop the Job

stop

And you can also try adding the script in your PowerShell Profile , if you want to run the script when you open PowerShell console, like I’ve done in my PS profile

profile

SCRIPT: 

NOTE :

There more ways through which, you can play Random music using powershell. Like one in below screenshot, which uses the ‘PLAY’ Verb associated with a music file to play music on default music player.

more

Hope you’ll enjoy scripting with some Automated music from today 🙂

@SinghPrateik