利用powershell转wps文档到pdf
$input_path = "D:\wps"
$output_path = "D:\pdf"
$wps = New-Object -ComObject KWPS.Application
$Format = [Microsoft.Office.Interop.Word.WdSaveFormat]::wdFormatPDF
Get-ChildItem -Path $input_path -Filter *.doc? | ForEach-Object {
$doc = $wps.Documents.Open($_.FullName)
$pdf = "$output_path\$($_.BaseName).pdf"
$doc.ExportAsFixedFormat([ref] $pdf, [ref] $Format)
$doc.Close()
}
$wps.Quit()