print automatically html file with powershell print automatically html file with powershell powershell powershell

print automatically html file with powershell


get-content c:\test.html  | out-printer

Print to default printer.

Edit:

if you need print rendered htlm page:

$ie = new-object -com "InternetExplorer.Application"$ie.Navigate("c:\test.html")$ie.ExecWB(6,2)

Edit after comments:

I can run this in a testprint.ps1 file:

$ie = new-object -com "InternetExplorer.Application"$ie.Navigate("c:\test.html")while ( $ie.busy ) { Start-Sleep -second 3 }$ie.ExecWB(6,2)while ( $ie.busy ) { Start-Sleep -second 3 }$ie.quit()