Introduction to “PowerShell Module to Play Music”:

This is in continuation to one of my previous blog post wherein I wrote a script to play random songs in the background using the Powershell console.

Though there are already some Windows Media player automation scripts available in the community, I was looking for something that as easy as “Single cmdlet” and provides easy controls like Shuffle, Loop, Stop, ShowPlayList and Filter hence I wrote this script myself.

Video Demo:

Functionalities:

I’ve included few more functionalities to the script which are following

Plays in background



Plays all music in the background on a hidden Windows Media Player Instance and you can continue with your work.

Filter Audio Files

Music Controls

Enables you to Control your music from the Shell no need to switch windows, by providing options like Shuffle



Loop

Stop



Now Playing Notifications



You get notified by an Information balloon in the bottom right corner of your screen whenever a new audio starts playing. This balloon will pop up every time one audio ends and a new one starts. Stores\Caches last accessed directory



This function caches/stores information of last accessed directory in a temporary file so that you don’t have to provide Music directory every time you run the function

Displays information and user preferences



Provides information like Number of Songs that will be played, Total Play duration, and Mode chosen by the user in the PowerShell console itself. Support Switch aliases All music control switches and parameters support Aliases for all those lazy people out there 😛



How it works (The Core Logic):

Installation:

On PowerShell v5.x: You can install the MusicPlayer module directly from the PowerShell Gallery On PowerShell v4 and Earlier:

GitHub Repository [Fork it!]:

Get the complete script from my GitHub Repository here



Hoping you’ll find it fun and useful, cheers.. signing off…

Follow @SinghPrateik



