使用 CMD 关联文件

T.T*_*dua 2 cmd file associations

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

Jos*_*efZ 5

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

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

或者

ftype TIFImage.Document="C:\Program Files\MSPVIEW.exe" "%1"
assoc .tif=TIFImage.Document
assoc .tiff=TIFImage.Document
Run Code Online (Sandbox Code Playgroud)

请注意,我还没有MSPVIEW.exe安装,所以我无法批准您的ftype分配正确性。在我的Windows ftype TIFImage.Document命令输出如下:

TIFImage.Document=%SystemRoot%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1
Run Code Online (Sandbox Code Playgroud)