# encoding: ascii
# api: powershell
# title: print-file
# description: simple V1 function to print files, either listed, or through the pipeline. No error checking implemented
# version: 0.1
# type: function
# author: karl prosser
# license: CC0
# function: print-file
# x-poshcode-id: 843
# x-archived: 2016-03-06T11:35:26
# x-published: 2009-02-03T12:56:00
#
#
function print-file($file)
{
begin {
function internal-printfile($thefile)
{
if ($thefile -is [string]) {$filename = $thefile }
else {
if ($thefile.FullName -is [string] ) { $filename = $THEfile.FullName }
}
$start = new-object System.Diagnostics.ProcessStartInfo $filename
$start.Verb = "print"
[System.Diagnostics.Process]::Start($start)
}
if ($file -ne $null) {
$filespecified = $true;
internal-printfile $file
}
}
process{if (!$filespecified) { write-Host process ; internal-printfile $_ } }
}