它是將擴展名與檔類型(FTYPE
)相關聯的批處理命令,顯示現有關聯或刪除關聯。
語法
assoc – Displays all the file extensions
assoc | find “.ext” – Displays only those file extensions which have the extension ext.
示例
將以下代碼保存在檔:assoc.bat 中,如下所示 -
@echo off
assoc > F:\worksp\batch_script\lists.txt
assoc | find ".doc" > F:\worksp\batch_script\listsdoc.txt
檔關聯列表將定向輸出到檔lists.txt
。以下輸出顯示了運行上述批處理檔後,listsdoc.txt
檔中的內容。
F:\worksp\batch_script>assoc.bat
listsdoc.txt
檔中的內容 -
.doc=Word.Document.8
.dochtml=wordhtmlfile
.docm=Word.DocumentMacroEnabled.12
.docmhtml=wordmhtmlfile
.docx=Word.Document.12
.docxml=wordxmlfile