Skip to content
This repository was archived by the owner on Nov 8, 2018. It is now read-only.

PowerShell Primer

jherby2k edited this page Nov 3, 2014 · 10 revisions

Purpose

This guide is intended to get you up and running with AudioShell if you've never used PowerShell before. For a more comprehensive introduction, visit http://technet.microsoft.com/en-ca/scriptcenter/powershell.aspx and watch some of the webcasts.

Introduction

PowerShell is the new command line and scripting environment for Windows. Traditional console applications simply read and/or write text to and from the console. PowerShell works with objects instead of text, and instead of executables like lame.exe, it uses cmdlets, like Get-AudioShell.

Cmdlets

Cmdlets are easier to work with than executables, because they are consistent. In the console world, there are dozens of different switch conventions, even for getting help (--help, -h, -?, /?). In PowerShell, you can always get help for a cmdlet by using another cmdlet: Get-Help.

Cmdlets are always named with a verb-noun pair. In AudioShell, the noun always begins with Audio. So if you want to get something audio-related, type _Get-Audio _and then hit tab to cycle through the available options.

Objects

Because PowerShell works with objects, you're typically sending objects from one cmdlet to another. In AudioShell, those objects are usually of the class AudioFile. An AudioFile object has properties, like a FileInfo object (itself containing properties like the file name), an AudioInfo object (containing useful stuff like the bitrate and sample rate) and a Metadata object (containing tags like the artist and title). Objects can also have methods on them, like SaveMetadata.

Often, these properties and methods are used behind the scenes by the AudioShell cmdlets. But it's nice to know they're there.

Clone this wiki locally