This script converts Word compatible documents to a selected format utilizing the Word SaveAs function. Each file is converted by a single dedicated Word COM instance.
The script converts either all documents in a single folder matching an include-filter or a single file.
Currently supported target document types:
The conversion is handled by Word itself, utilizing the SaveAs method.
The Word.Document.SaveAs method supports the following wdFormat values:
Implemented document formats are shown in bold.
# EXAMPLE # Convert all .doc files in E:\temp to Default .\Convert-WordDocument.ps1 -SourcePath E:\Temp -IncludeFilter *.doc # EXAMPLE # Convert all .doc files in E:\temp to XPS .\Convert-WordDocument.ps1 -SourcePath E:\Temp -IncludeFilter *.doc -TargetFormat XPS # EXAMPLE # Convert a single document to Word default format .\Convert-WordDocument.ps1 -SourcePath E:\Temp\MyDocument.doc