Imagine if you paid for a piece of software and the people who made it decided they’re just going to remotely uninstall it.

  • NKBTN@feddit.uk
    link
    fedilink
    English
    arrow-up
    4
    ·
    19 hours ago

    I know how to do that, but doing them all would take… ok, probably a little over and hour. So not THAT long, but I’d much prefer to leave a script running

    • KyuubiNoKitsune@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      9 hours ago

      I haven’t seen an official script, but found one on the MS learn site that should work.

      https://learn.microsoft.com/en-us/answers/questions/5399481/i-have-some-old-pub-files-which-i-want-to-convert

      You need to have publisher installed.

      Copy all your PUB files into a folder.

      Press Start and type in powershell, and open powershell.

      Copy the code below into notepad and replace C:\PubFiles with the path to your folder, then copy the script and paste it into the powershell window by right clicking on the window (it pastes when you right click).

      (You might need to press enter after pasting it)

      $PubFilePath = "C:\PubFiles"
      
      $publisher = New-Object -ComObject Publisher.Application
      
      $files = Get-ChildItem $PubFilePath -Recurse -Filter \*.pub
      
      foreach ($file in $files) {
      
          try{
      
              $doc $publisher.Open($file.FullName)
      
              $pdfPath = \[System.IO.Path]::ChangeExtension($file.FullName, ".pdf")
      
              $doc.ExportAsFixedFormat(\[Microsoft.Office.Interop.Publisher.PbFixedFormatType]::pbFixedFormatTypePDF$pdfPath)
      
              $doc.Close()
      
              } catch {
      
                  Write-Error "Failed to convert $($file.FullName)"
      
              }
      
      }
      
      $publisher.Quit()