18

When I open Sumatra I need inverted colors by default. But even though I changed the shortcuts to: "/sumatraPDF.exe" -invert-colors the program runs without the flag when I double click a PDF file at a time where the program is closed.

How do I make sure the flag is used when double clicking PDF files?

1
  • 1
    Your program shortcuts are unrelated to the extension association. Mar 23, 2017 at 13:31

1 Answer 1

44

How do I make sure the flag is used when double clicking pdf files?

You need to modify the command that is run, using ftype:

  1. Find out the file type using assoc:

    assoc .pdf
    
  2. This will return something similar to:

    .pdf=AcroExch.Document.DC
    
  3. Now use ftype to get the current command run for a .pdf:

    ftype AcroExch.Document.DC
    
  4. This will return something similar to:

    AcroExch.Document.DC="C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" "%1"
    
  5. Now set up a new command with your extra flag:

    ftype AcroExch.Document.DC="C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" -invert-colors "%1"
    

Note:

  • I've used Acrobat in my example above as I don't have Sumatra installed.

Further Reading

  • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
  • assoc - Display or change the association between a file extension and a fileType
  • ftype - Display or change the link between a FileType and an executable program.
5
  • @Coolwater Great!
    – DavidPostill
    Mar 22, 2017 at 17:31
  • 4
    You can do the same thing by editing the registry directly, but instead of using ftype, you'll be chasing references starting at HKEY_CLASSES_ROOT\.pdf.
    – Mark
    Mar 22, 2017 at 21:28
  • 2
    @Mark I know. I went for the simpler, less dangerous approach :)
    – DavidPostill
    Mar 22, 2017 at 21:29
  • Oh, nice. And it should work form WinXP forward.
    – Ajasja
    Mar 23, 2017 at 12:10
  • 1
    I think it might be worth mentioning that application updates and upgrades might overwrite these changes so it might be something that has to be done repeatedly. I would expect this from Adobe at least.
    – Matt
    Mar 23, 2017 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.