mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-26 08:38:51 +01:00
25 lines
639 B
PowerShell
Executable File
25 lines
639 B
PowerShell
Executable File
<#
|
|
.SYNTAX play-files.ps1 [<file(s)>]
|
|
.DESCRIPTION plays the given audio files (supporting MP3 and WAV format)
|
|
.LINK https://github.com/fleschutz/PowerShell
|
|
.NOTES Author: Markus Fleschutz / License: CC0
|
|
#>
|
|
|
|
param($Files = "*")
|
|
|
|
try {
|
|
foreach ($File in (get-childItem -path "$Files" -attributes !Directory)) {
|
|
if ("$File" -like "*.mp3") {
|
|
& "$PSScriptRoot/play-mp3.ps1" "$File"
|
|
} elseif ("$File" -like "*.wav") {
|
|
& "$PSScriptRoot/play-mp3.ps1" "$File"
|
|
} else {
|
|
"Skipping $File ..."
|
|
}
|
|
}
|
|
exit 0
|
|
} catch {
|
|
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
exit 1
|
|
}
|