Skip to main content

Posts

Showing posts with the label Fun

PowerShell : Play Music until Sleep

A while back I had blogged about using PowerShell to create a playlist of random songs in VLC player & I had a rudimentary function based on that in my profile. 001 002 003 004 005 006 function   play-song {      param ( [int] $count = 5 ,   [string] $Path = "D:\Songs" )      Get-ChildItem   $Path   -recurse   -filter   *.mp3 |   Get-Random   -Count   $count   |          ForEach-Object   -process  {  Start-Process   $_ . Fullname  -verb   'AddtoPlaylistVLC' } } I know the name contains an unapproved verb but I was lazy to change it. Few days back I thought of extending above function a little bit, so that my laptop Sleeps when the songs in the playlist end (hopefully I would have slept by that time )