{"id":16871,"date":"2010-10-09T00:01:00","date_gmt":"2010-10-09T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2010\/10\/09\/weekend-scripter-a-cool-music-explorer-script\/"},"modified":"2010-10-09T00:01:00","modified_gmt":"2010-10-09T00:01:00","slug":"weekend-scripter-a-cool-music-explorer-script","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/weekend-scripter-a-cool-music-explorer-script\/","title":{"rendered":"Weekend Scripter: A Cool Music Explorer Script"},"content":{"rendered":"<p>&#160;<\/p>\n<p>Microsoft Scripting Guy Ed Wilson here. I don\u2019t know about you, but I have thousands of music files on my computer. In fact, I have exactly 4,018 music files. I used this <a href=\"http:\/\/technet.microsoft.com\/en-us\/scriptcenter\/powershell.aspx\">Windows PowerShell<\/a> command to count them:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#0000ff\">PS<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">E:\\Music&gt;<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">(<\/font><font color=\"#0000ff\">dir<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-Include<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">*.mp3,*.wma<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-Recurse<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">|<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">Measure-Object<\/font><font color=\"#000000\">).count<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#800000\">4018<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#0000ff\">PS<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">E:\\Music&gt;<\/font> <\/div>\n<\/blockquote>\n<p>One problem with having 4,018 music files on my computer is that at times I am not sure what I want to listen to, or even what a particular song might sound like. Whereas the <a href=\"http:\/\/social.zune.net\/home.aspx?culture=en-us\">Zune<\/a> software is really cool and has several nice modes for playing music, at times I prefer a bit more automated operation. Unfortunately, there are no <a href=\"http:\/\/zune.net\/en-us\/products\/zunehd\/default.htm\">Zune HD<\/a> cmdlets available\u2014at least none that I know of. <\/p>\n<p>Luckily, Windows PowerShell has access to the .NET Framework, and using some basic Windows PowerShell techniques and an easy-to-use .NET Framework class, a pretty cool music explorer script can be easily crafted. <\/p>\n<p>The <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.windows.media.mediaplayer.aspx\">system.windows.media.mediaplayer<\/a> .NET Framework class is just the tool that we need. Actually, the class name is <b>mediaplayer<\/b>, and it is found in the <b>system.windows.media<\/b> .NET Framework namespace. Namespaces in the .NET Framework work like folders that group similar items together, or like DNS domain names that group computers into domains. The MSDN .NET Framework documentation makes fascinating reading, and the fact that the classes are grouped into namespaces makes it easy to peruse. I often spend entire weekends browsing the namespaces, selecting interesting classes, and trying them out in Windows PowerShell scripts. The <b>system.windows.media<\/b> .NET Framework namespace documentation is shown in the following image.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3225.wes-10-09-10-01_72286A15.jpg\"><img decoding=\"async\" title=\"Image of system.windows.media .NET Framework namespace documentation\" style=\"border-right: 0px;padding-right: 0px;border-top: 0px;padding-left: 0px;border-left: 0px;padding-top: 0px;border-bottom: 0px\" height=\"429\" alt=\"Image of system.windows.media .NET Framework namespace documentation\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1663.wes-10-09-10-01_thumb_3E13CAC2.jpg\" width=\"604\" border=\"0\" \/><\/a><\/p>\n<p>I just click through the classes until I see something that sounds cool. I then read about it, and try it out. Often, there are useful code samples that illustrate using the classes; unfortunately, there are almost no code samples in Windows PowerShell. A few of the Microsoft PowerShell MVPs such as <a href=\"http:\/\/pshscripts.blogspot.com\/2009\/05\/get-elapsedtimeps1.html\">Thomas Lee<\/a> have added useful samples written in Windows PowerShell for some of the major .NET Framework classes (these show up in the discussion section at the very bottom of the page). <\/p>\n<p>The <b>mediaplayer<\/b> class is not immediately available. The first thing to do is to load the assembly that contains the class. MSDN tells you in which assembly a class resides, and that is what you will use with the <b>Add-Type<\/b> Windows PowerShell cmdlet. The <b>mediaplayer<\/b> class resides in an assembly called <b>presentationCore<\/b>. To load the <b>presentationCore<\/b> assembly, use the command shown here:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#000000\">Add-Type<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-AssemblyName<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">presentationCore<\/font> <\/div>\n<\/blockquote>\n<p>After the assembly has been loaded, it is time to create an instance of the <b>mediaplayer<\/b> class. To do this, you will need to look up the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.windows.media.mediaplayer.mediaplayer.aspx\">mediaplayer constructor<\/a> on MSDN. Luckily, we do not need to pass anything to <b>New-Object<\/b> when we create the instance of the <b>mediaplayer<\/b> class. Sometimes, .NET Framework classes require one or more parameters to be supplied when creating a new instance of the class, and therefore it is always a good idea to review the constructor details in MSDN before attempting to create the class. Because the <b>mediaplayer<\/b> class requires no parameters, the code to create the class is simple and is shown here:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#2b91af\">$mediaPlayer<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">New-Object<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">system.windows.media.mediaplayer<\/font> <\/div>\n<\/blockquote>\n<p>The <b>path<\/b> variable is used to store the path to the music files I wish to gather, and the <a href=\"http:\/\/www.bing.com\/visualsearch?g=powershell_cmdlets&amp;FORM=Z9GE22\">Get-ChildItem cmdlet<\/a> is used to collect those files. The script retrieves both MP3 and WMA files and stores the returned <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.io.fileinfo(VS.80).aspx\">system.io.fileinfo<\/a> objects in the <b>$files<\/b> variable, as shown here:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#2b91af\">$path<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\"> &quot;E:\\Music\\classical\\Luciano Pavarotti&quot;       <br \/><\/font><font color=\"#2b91af\">$files<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">Get-ChildItem<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-path<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$path<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-include<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">*.mp3,*.wma<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-recurse<\/font> <\/div>\n<\/blockquote>\n<p>After the collection of files is stored in the <b>$files<\/b> variable, the <a href=\"http:\/\/blogs.technet.com\/heyscriptingguy\/archive\/2009\/05\/05\/how-can-i-loop-through-collections-with-windows-powershell.aspx\">Foreach<\/a> statement is used to walk through the collection. Inside the loop, each file is referenced by the <b>$file<\/b> variable. This is shown here:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#0000ff\">foreach<\/font><font color=\"#000000\">(<\/font><font color=\"#2b91af\">$file<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">in<\/font><font color=\"#8080\n80\">&#160;<\/font><font color=\"#2b91af\">$files<\/font><font color=\"#000000\">)<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">{<\/font> <\/div>\n<\/blockquote>\n<p>The <b>basename<\/b> property was added in <a href=\"http:\/\/support.microsoft.com\/kb\/968929\">Windows PowerShell 2.0<\/a> to the <b>fileinfo<\/b> class, and it is the file name minus the file extension. This is used to display an indicator of the song that is being played and is shown here:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#808080\">&quot;Playing $($file.BaseName)&quot;<\/font> <\/div>\n<\/blockquote>\n<p>The <b>fullname<\/b> property from the <b>fileinfo<\/b> class contains the complete path to the file. This path is converted to a <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.uri.aspx\">system.uri<\/a> .NET Framework class, and is passed to the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.windows.media.mediaplayer.open.aspx\">open method of the mediaplayer class<\/a>. One of the <b>system.uri<\/b> constructors accepts a string. When accessing a .NET Framework class, the name can be placed inside square brackets and the Word <i>system<\/i> left off. This gives us <b>[uri]<\/b>. The constructor is then supplied to it directly. This is illustrated here:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#0000ff\">PS<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">C:\\&gt;<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">[uri]<\/font><font color=\"#808080\">&quot;E:\\Music\\classical\\Luciano Pavarotti\\Live 1961-1966\\01.wma&quot;       <\/p>\n<p><\/font><font color=\"#000000\">AbsolutePath<\/font><font color=\"#808080\">&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">E:\/Music\/classical\/Luciano%20Pavarotti\/Live%201961-1966\/<\/font><font color=\"#800000\">01<\/font><font color=\"#000000\">.wma<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">AbsoluteUri<\/font><font color=\"#808080\">&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">file:\/\/\/E:\/Music\/classical\/Luciano%20Pavarotti\/Live%201961-1966\/<\/font><font color=\"#800000\">01<\/font><font color=\"#000000\">.<\/font><font color=\"#808080\">       <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">wma<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">Authority<\/font><font color=\"#808080\">&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">Host<\/font><font color=\"#808080\">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">HostNameType<\/font><font color=\"#808080\">&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">Basic<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">IsDefaultPort<\/font><font color=\"#808080\">&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">True<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">IsFile<\/font><font color=\"#808080\">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">True<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">IsLoopback<\/font><font color=\"#808080\">&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">True<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">IsUnc<\/font><font color=\"#808080\">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">False<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">LocalPath<\/font><font color=\"#808080\">&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">E:\\Music\\classical\\Luciano<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">Pavarotti\\Live<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">1961-1966\\01.wma<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">PathAndQuery<\/font><font color=\"#808080\">&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">E:\/Music\/classical\/Luciano%20Pavarotti\/Live%201961-1966\/<\/font><font color=\"#800000\">01<\/font><font color=\"#000000\">.wma<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">Port<\/font><font color=\"#808080\">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-1<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">Query<\/font><font color=\"#808080\">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">Fragment<\/font><font color=\"#808080\">&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">Scheme<\/font><font color=\"#808080\">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">file<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">OriginalString<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">E:\\Music\\classical\\Luciano<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">Pavarotti\\Live<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">1961-1966\\01.wma<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">DnsSafeHost<\/font><font color=\"#808080\">&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">IsAbsoluteUri<\/font><font color=\"#808080\">&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">True<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">Segments<\/font><font color=\"#808080\">&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">{\/,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">E:\/,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">Music\/,<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">classical\/&#8230;}<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">UserEscaped<\/font><font color=\"#808080\">&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">False<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">UserInfo<\/font><font color=\"#808080\">&#160;&#160;&#160;&#160;&#160;&#160; <\/font><font color=\"#000000\">:<\/font><font color=\"#808080\">       <\/p>\n<p><\/font><font color=\"#0000ff\">PS<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">C:\\&gt;<\/font> <\/div>\n<\/blockquote>\n<p>Because the <b>open<\/b> method of the <b>mediaplayer<\/b> class accepts a <b>system.uri<\/b>, I do not need to worry about which property to supply. The <b>mediaplayer<\/b> class is smart enough to choose what I need from the incoming object. A subexpression is used on the <b>fullname<\/b> property of the <b>fileinfo<\/b> class to retrieve the string path to the file. This portion of the script is shown here:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#2b91af\">$mediaPlayer<\/font><font color=\"#000000\">.open([uri]<\/font><font color=\"#808080\">&quot;$($file.fullname)&quot;<\/font><font color=\"#000000\">)<\/font> <\/div>\n<\/blockquote>\n<p>The remainder of the script is really easy. I call the <b>play<\/b> method fr\nom the <b>mediaplayer<\/b> class, use the <b>Start-Sleep<\/b> Windows PowerShell cmdlet to pause the script for 10 seconds, and then call the <b>stop<\/b> method to halt playing the tune. I then loop around to the next file in the <b>$files<\/b> collection. This is shown here:<\/p>\n<blockquote>\n<div class=\"code\"><font color=\"#2b91af\">$mediaPlayer<\/font><font color=\"#000000\">.Play()<\/font><font color=\"#808080\">       <br \/>&#160;<\/font><font color=\"#0000ff\">Start-Sleep<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-Seconds<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#800000\">10<\/font><font color=\"#808080\">       <br \/>&#160;<\/font><font color=\"#2b91af\">$mediaPlayer<\/font><font color=\"#000000\">.Stop()<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">}<\/font> <\/div>\n<\/blockquote>\n<p>The complete PlayMedia.ps1 script is shown here.<\/p>\n<blockquote>\n<p><strong>PlayMedia.ps1<\/strong><\/p>\n<p><font color=\"#000000\">Add-Type<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-AssemblyName<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">presentationCore<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#2b91af\">$mediaPlayer<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">New-Object<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">system.windows.media.mediaplayer<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#2b91af\">$path<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\"> &quot;E:\\Music\\classical\\Luciano Pavarotti&quot;       <br \/><\/font><font color=\"#2b91af\">$files<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">=<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#0000ff\">Get-ChildItem<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-path<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$path<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-include<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">*.mp3,*.wma<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-recurse<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#0000ff\">foreach<\/font><font color=\"#000000\">(<\/font><font color=\"#2b91af\">$file<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">in<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#2b91af\">$files<\/font><font color=\"#000000\">)<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">{<\/font><font color=\"#808080\">       <br \/> &quot;Playing $($file.BaseName)&quot;        <br \/>&#160;<\/font><font color=\"#2b91af\">$mediaPlayer<\/font><font color=\"#000000\">.open([uri]<\/font><font color=\"#808080\">&quot;$($file.fullname)&quot;<\/font><font color=\"#000000\">)<\/font><font color=\"#808080\">       <br \/>&#160;<\/font><font color=\"#2b91af\">$mediaPlayer<\/font><font color=\"#000000\">.Play()<\/font><font color=\"#808080\">       <br \/>&#160;<\/font><font color=\"#0000ff\">Start-Sleep<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#000000\">-Seconds<\/font><font color=\"#808080\">&#160;<\/font><font color=\"#800000\">10<\/font><font color=\"#808080\">       <br \/>&#160;<\/font><font color=\"#2b91af\">$mediaPlayer<\/font><font color=\"#000000\">.Stop()<\/font><font color=\"#808080\">       <br \/><\/font><font color=\"#000000\">}<\/font> <\/p>\n<\/blockquote>\n<p>When the script runs, each file name is displayed in either the Windows PowerShell console or the Windows PowerShell ISE output pane, depending on how you launched the script. <\/p>\n<p>We invite you to follow us on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\">Facebook<\/a>. If you have any questions, send email to us at <a href=\"mailto:scripter@microsoft.com\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/social.technet.microsoft.com\/Forums\/en\/ITCG\/threads\/\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson and Craig Liebendorfer, Scripting Guys<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#160; Microsoft Scripting Guy Ed Wilson here. I don\u2019t know about you, but I have thousands of music files on my computer. In fact, I have exactly 4,018 music files. I used this Windows PowerShell command to count them: PS&#160;E:\\Music&gt;&#160;(dir&#160;-Include&#160;*.mp3,*.wma&#160;-Recurse&#160;|&#160;Measure-Object).count 4018 PS&#160;E:\\Music&gt; One problem with having 4,018 music files on my computer is that at [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[123,3,61,192,45],"class_list":["post-16871","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-multimedia","tag-scripting-guy","tag-weekend-scripter","tag-windows-media-player-and-audio","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>&#160; Microsoft Scripting Guy Ed Wilson here. I don\u2019t know about you, but I have thousands of music files on my computer. In fact, I have exactly 4,018 music files. I used this Windows PowerShell command to count them: PS&#160;E:\\Music&gt;&#160;(dir&#160;-Include&#160;*.mp3,*.wma&#160;-Recurse&#160;|&#160;Measure-Object).count 4018 PS&#160;E:\\Music&gt; One problem with having 4,018 music files on my computer is that at [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/16871","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=16871"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/16871\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=16871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=16871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=16871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}