Created
October 11, 2016 19:13
-
-
Save ngharo/eadc96c52171759eeb0d396ad9b6e12d to your computer and use it in GitHub Desktop.
bulk convert folder of docx files to pdfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Acquire a list of DOCX files in a folder | |
$Files=GET-CHLDITEM 'C:\FooFolder\*.DOCX' | |
Foreach ($File in $Files) { | |
# open a Word document, filename from the directory | |
$Doc=$Word.Documents.Open($File.fullname) | |
# Swap out DOCX with PDF in the Filename | |
$Name=($Doc.Fullname).replace("docx","pdf") | |
# Save this File as a PDF in Word 2010/2013 | |
$Doc.saveas([ref] $Name, [ref] 17) | |
$Doc.close() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment