mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-09 18:19:32 +02:00
Add play-files.ps1
This commit is contained in:
parent
9bd33214b1
commit
a378f3ae47
@ -134,6 +134,7 @@ open-calculator.ps1, starts the calculator program
|
||||
open-email-client.ps1, starts the default email client
|
||||
open-file-explorer.ps1, starts the Microsoft File Explorer
|
||||
play-beep.ps1, plays a beep sound
|
||||
play-files.ps1, plays the given audio files
|
||||
play-mission-impossible.ps1, plays the Mission Impossible theme
|
||||
play-m3u.ps1, plays the given playlist (M3U file format)
|
||||
play-mp3.ps1, plays the given sound file (MP3 file format)
|
||||
|
|
@ -10,6 +10,7 @@ Mega Collection of PowerShell Scripts
|
||||
* [convert-txt2wav.ps1](Scripts/convert-txt2wav.ps1) - converts text to a .WAV audio file
|
||||
* [mute-audio.ps1](Scripts/mute-audio.ps1) - mutes audio
|
||||
* [play-beep.ps1](Scripts/play-beep.ps1) - plays a beep sound
|
||||
* [play-files.ps1](Scripts/play-files.ps1) - plays the given audio files
|
||||
* [play-mission-impossible.ps1](Scripts/play-mission-impossible.ps1) - plays the Mission Impossible theme
|
||||
* [play-m3u.ps1](Scripts/play-m3u.ps1) - plays the given playlist (M3U file format)
|
||||
* [play-mp3.ps1](Scripts/play-mp3.ps1) - plays the given sound file (MP3 file format)
|
||||
|
24
Scripts/play-files.ps1
Executable file
24
Scripts/play-files.ps1
Executable file
@ -0,0 +1,24 @@
|
||||
<#
|
||||
.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"
|
||||
} else if ("$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
|
||||
}
|
Loading…
Reference in New Issue
Block a user