mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-26 16:48:54 +01:00
28 lines
576 B
PowerShell
Executable File
28 lines
576 B
PowerShell
Executable File
<#
|
|
.SYNOPSIS
|
|
Prints an image
|
|
.DESCRIPTION
|
|
This PowerShell script shows the printer dialogue to print the given image file.
|
|
.PARAMETER Path
|
|
Specifies the path to the image file
|
|
.EXAMPLE
|
|
PS> ./print-image dog.jpg
|
|
.LINK
|
|
https://github.com/fleschutz/PowerShell
|
|
.NOTES
|
|
Author: Markus Fleschutz | License: CC0
|
|
#>
|
|
|
|
param($Path = "")
|
|
|
|
try {
|
|
if ("$Path" -eq "") {
|
|
$Path = Read-Host "Enter path to the image file"
|
|
}
|
|
Start-Process -filepath $Path -verb print
|
|
exit 0 # success
|
|
} catch {
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
exit 1
|
|
}
|