creating script to convert word docs into pdf... need help with script so that it deletes the word doc after it is converted RRS feed

  • Question

  • this is the script we are currently using

    $wdFormatPDF = 17 $word = New-Object -ComObject word.application $word.visible = $false $folderpath = "c:\fso\*" $fileTypes = "*.docx","*doc" Get-ChildItem -path $folderpath -include $fileTypes | foreach-object ` { $path = ($_.fullname).substring(0,($_.FullName).lastindexOf(".")) "Converting $path to pdf ..." $doc = $$_.fullname) $doc.saveas([ref] $path, [ref]$wdFormatPDF) $doc.close() } $word.Quit()

    How can we set it to delete the word doc after it has been opened and converted

    Wednesday, February 11, 2015 9:53 PM