如何在 *.EXE 文件上将标志设置为默认值?

Coo*_*ter 18 windows flag command-line-arguments

当我打开苏门答腊时,默认情况下我需要反转颜色。但即使我将快捷方式更改为:"/sumatraPDF.exe" -invert-colors当我PDF在程序关闭时双击文件时,程序运行时没有标志。

双击PDF文件时如何确保使用该标志?

Dav*_*ill 44

双击pdf文件时如何确保使用该标志?

您需要使用ftype修改运行的命令:

  1. 使用assoc找出文件类型:

    assoc .pdf
    
    Run Code Online (Sandbox Code Playgroud)
  2. 这将返回类似于:

    .pdf=AcroExch.Document.DC
    
    Run Code Online (Sandbox Code Playgroud)
  3. 现在使用ftype获取 .pdf 的当前命令运行:

    ftype AcroExch.Document.DC
    
    Run Code Online (Sandbox Code Playgroud)
  4. 这将返回类似于:

    AcroExch.Document.DC="C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" "%1"
    
    Run Code Online (Sandbox Code Playgroud)
  5. 现在用你的额外标志设置一个新命令:

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

笔记:

  • 我在上面的示例中使用了 Acrobat,因为我没有安装 Sumatra。

进一步阅读

  • Windows CMD 命令行的 AZ 索引- Windows cmd 行相关的所有内容的极好参考。
  • assoc - 显示或更改文件扩展名和文件类型之间的关联
  • ftype - 显示或更改 FileType 和可执行程序之间的链接。

  • 你可以通过直接编辑注册表来做同样的事情,但不是使用 `ftype`,你将追逐从 `HKEY_CLASSES_ROOT\.pdf` 开始的引用。 (4认同)
  • @马克我知道。我选择了更简单、更危险的方法:) (2认同)