Skip to main content
Nintex Community Menu Bar

25799i0FF18D63126DD7F9.jpg25800iBB037D5B0220536C.png25801i6C93B53E37C7DD81.png25802i7BBD1C46AB8C152B.png 

25803iCDB67BEED6B07E59.pngyou can write the full path to a single file, instead of *.docx

 

$dollar$Files = Get-ChildItem "D:*.docx"

 

$dollar$Word = New-Object -ComObject Word.Application

 

Foreach ($dollar$File in $dollar$Files) {

  # open a Word document, filename from the directory

  $dollar$Doc = $dollar$Word.Documents.Open($dollar$File.FullName)

 

  # Swap out DOCX with PDF in the Filename

 $dollar$Name=($dollar$Doc.FullName).Replace("docx","pdf")

 

  # Save this File as a PDF in Word 2010/2013

  $dollar$Doc.SaveAs(oref] $dollar$Name, fref] 17)

  $dollar$Doc.Close()

}

Be the first to reply!

Reply