无涯教程-批处理 - ASSOC函数

83 阅读1分钟

这是一个批处理命令,用于将扩展名与文件类型(FTYPE)关联,显示现有关联或删除关联。

ASSOC - 语法

assoc  Displays all the file extensions 
assoc | find “.ext  Displays only those file extensions which have the extension ext.

ASSOC - 示例

@echo off 
assoc > C:\lists.txt 
assoc | find “.doc > C:\listsdoc.txt

文件关联列表将路由到文件lists.txt。以下输出显示了运行上述批处理文件后,listsdoc.txt文件中的内容。

.doc=Word.Document.8 
.dochtml=wordhtmlfile 
.docm=Word.DocumentMacroEnabled.12 
.docmhtml=wordmhtmlfile 
.docx=Word.Document.12 
.docxml=wordxmlfile

参考链接

www.learnfk.com/batch-scrip…