< Back

Invoke-MusicPlayer

Sat Jan 18, 2020 4:52 pm

NAME Invoke-MusicPlayer



SYNOPSIS

Plays music on Windows Media Player in backgroud.





SYNTAX

Invoke-MusicPlayer [[-Path] <String>] [[-Filter] <String>] [-Shuffle] [-Stop] [-Loop] [-ShowPlaylist]

[<CommonParameters>]





DESCRIPTION

Invoke-MusicPlayer Cmdlet automates Windows Media Player to play songs in Background in order (Random/Sequential)

chosen by the user.

Moreover, It generates a balloon notification in bottom Right corner of the screen, whenever a new song starts

playing and continues to do that until manually stopped or it completes playing all songs.





PARAMETERS

-Path <String>

Path of the Music Directory.

like, Music -Path C:\\music\\



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Filter <String>

String that can be used to filter out songs in a directory. Wildcards are allowed.



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Shuffle [<SwitchParameter>]

Switch to play music in shuffle mode, default value is 'sequential'



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Stop [<SwitchParameter>]

Switch to kill any instance of Music playing in backgroud.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Loop [<SwitchParameter>]

Switch to continuously play songs in a infinite Loop.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-ShowPlaylist [<SwitchParameter>]



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Author : Prateek Singh

Twitter : @SinghPrateik

Blog : RidiCurious.com



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Music C:\\Music\\



Directory : C:\\Music\\

Count : 4

PlayDuration(in mins) : 14

Mode : Sequential

Current : Cheap Thrills - Vidya Vox Cover.mp3

Next : Despacito - Luis Fonsi.mp3



Example shows how to run music from by passing a music directory to the Function









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>play -Verbose



VERBOSE: You've not provided a music directory. Looking for cached information from previous execution of this

cmdlet

VERBOSE: Starting a background Job to play audio files





Directory : C:\\Music\\

Count : 4

PlayDuration(in mins) : 14

Mode : Sequential

Current : Cheap Thrills - Vidya Vox Cover.mp3

Next : Despacito - Luis Fonsi.mp3



Example shows that in case you don't provide a music directory, the function Looks for the cached information of

the diretory from previous us of the function.

Moreover, It displays the information like Count, Total play duration, and Mode chosen by the user









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>play -Shuffle



Directory : C:\\Music\\

Count : 4

PlayDuration(in mins) : 14

Mode : Shuffle

Current : Cheap Thrills - Vidya Vox Cover.mp3

Next : Whats My Name - Rihanna.mp3



Choose 'Shuffle' switch to play music in shuffle mode, default value is 'sequential'.









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Music -Shuffle -Loop



Directory : C:\\Music\\

Count : 4

PlayDuration(in mins) : Infinite

Mode : Shuffle in Loop

Current : Lovers On The Sun - David Guetta.mp3

Next : Cheap Thrills - Vidya Vox Cover.mp3



Choose 'Loop' switch inorder to continuously play songs in a infinite Loop.









-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Music -Stop -Verbose



VERBOSE: Stoping any Already running instance of Media in background.



When 'Stop' switch is used any instance Music playing in backgroud stops.











RELATED LINKS