Programmerare, skeptiker, sekulärhumanist, antirasist.
Författare till bok om C64 och senbliven lantis.
Röstar pirat.
2012-06-15
PowerShell can make use of the .NET Framework, and can load assemblies using the Load function in System.Reflection.Assembly. Also, PowerShell can also use any COM class that is registered on your system. This feature gives you the ability to automate applications like Microsoft Word and Excel, or why not Windows Media Player? An error will be thrown if you specify an unexisting COM type name. This code will create an instance of Windows Media Player, if you have it installed:
$player = New-Object -ComObject WMPLAYER.OCX
Then, the Windows Media Player API is at your fingertips, as described on MSDN. This command will give you some kick ass rock:
$player.URL = "F:\Music\ACDC - Who made who.mp3"
Enjoy!
Categories: PowerShell
Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll!
Leave a Reply