我想使用 powershell 将 html 文件打印到默认打印机。假设我有文件 c:\test.html ,其中包含以下文本:
<html>
<p> hello <b>world</b></p>
<html>
如何将 test.html 打印到默认打印机?
先感谢您。
get-content c:\test.html | out-printer
打印到默认打印机。
Edit:
如果您需要打印渲染的 html 页面:
$ie = new-object -com "InternetExplorer.Application"
$ie.Navigate("c:\test.html")
$ie.ExecWB(6,2)
评论后编辑:
我可以在 testprint.ps1 文件中运行它:
$ie = new-object -com "InternetExplorer.Application"
$ie.Navigate("c:\test.html")
while ( $ie.busy ) { Start-Sleep -Seconds 3 }
$ie.ExecWB(6,2)
while ( $ie.busy ) { Start-Sleep -Seconds 3 }
$ie.quit()
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)