Mike Clack Jones

A journey through Ruby


Convert Directory of PPTX into PDF in PowerShell


This post is here for personal reference and was adapted from this link.
The following script allows you to convert a directory of Powerpoint slides into a set of PDFs. I found this particularly useful when I was revising some materials at work that I needed to access from my Android phone.


  1. Open PowerShell
  2. Navigate into the directory that contains all of your PPTX files
    1. Set-Location path\to\pptx\folder
  3. Run the following script:
$ppt = new-object -com powerpoint.application
$opt= [Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType]::ppSaveAsPDF
foreach($ifile in $(ls '.' -Filter '*.pptx')) {
$ifile = $ifile.FullName
$pres = $ppt.Presentations.Open($ifile)
$pathname = split-path $ifile
$filename = split-path $ifile -leaf
$file = $filename.split(".")[0]
$ofile = $pathname + "\\" + $file + ".pdf"
$pres.SaveAs($ofile, $opt)

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top