mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-08 17:28:18 +02:00
Add print-image.ps1
This commit is contained in:
parent
537d2b245a
commit
b185f9b145
27
Scripts/print-image.ps1
Normal file
27
Scripts/print-image.ps1
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<#
|
||||||
|
.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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user