Friday 15 June 2012

Closing a file powershell -



Closing a file powershell -

i trying write script opens pdf files in folder, prints them, , closes files. have first 2 parts working, can not find way close files after. i've done google searching found nothing. i'm new powershell if there improve way doing please allow me know:

class="lang-powershell prettyprint-override">get-childitem -filter *.pdf | foreach-object { # file item variable $_ write-host "printing: $($_.name)" #open file print command. start-process -filepath $_.fullname -verb print }

any tips appreciated!

i don't have experience curious start-process cmdlet print verb. googled , came looks solution problem:

start-process -filepath $.fullname -verb print -passthru | %{sleep 10;$_} | kill

source: http://gregcaporale.wordpress.com/2012/01/18/powershell-to-print-files-automatically/

powershell

No comments:

Post a Comment