使用 CMD 关联文件

标签 file cmd associations

从cmd关联文件有哪些方法? 例如,我希望通过命令提示符将 .txt 文件扩展名与典型程序关联? 正确的文件关联cmd命令是什么?

最佳答案

需要使用 ftypeassoc 命令,如下所示(并注意顺序很重要):

ftype txtfile="C:\Program Files (x86)\PSPad editor\PSPad.exe" "%1"
assoc .log=txtfile
assoc .txt=txtfile
assoc .wtx=txtfile

ftype TIFImage.Document="C:\Program Files\MSPVIEW.exe" "%1"
assoc .tif=TIFImage.Document
assoc .tiff=TIFImage.Document

请注意,我尚未安装 MSPVIEW.exe,因此无法批准您的 ftype 分配正确性。在我的Windowsftype TIFImage.Document命令输出如下:

TIFImage.Document=%SystemRoot%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1

关于使用 CMD 关联文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30821222/

相关文章:

bash - Vim:当 "[1]"存在时编辑 "1"的便携方式

ruby-on-rails - 通过 Rails ActiveRecord Association 调用类方法

Java向xml文件添加具有属性的元素

c++ - cmd.exe 打开pdf并打印

c - 逐行逐字符读取文件

Windows 相当于 UNIX pwd

java - 理解代码中的 UML 关联

ruby-on-rails - Rails ActiveRecord self.___ vs @____

c - 在 C 中读取文件和字符串数组

java - 无法从服务器上的java小程序读取相关文本文件