* assoc ( ftype ) - 拡張子の関連付け [#g47c5c00]

** 拡張子とファイルタイプの基礎知識 [#wd97e692]
- 拡張子.txtではレジストリにHKEY_CLASSES_ROOT\.txtというキーが存在し、既定の値txtfileが設定されている。このtxtfileをファイルタイプと言う。
- ファイルタイプtxtfileはレジストリHKEY_CLASSES_ROOT\txtfileというキー以下で各種設定がされる。

** 拡張子に関連付けられているファイルタイプの確認 [#v6b172af]
 assoc            # 全拡張子のファイルタイプ一覧
 assoc .xlsx      # .xlsx拡張子に関連付けられているファイルタイプ

** ファイルタイプに対して起動するプログラムの確認 [#d3999e6f]
 ftype                  # 全ファイルタイプに対する起動するプログラム一覧
 ftype Excel.Sheet.12   # ファイルタイプ"Excel.Sheet.12"に対する起動するプログラム

** 起動するプログラムを変更する [#p6bb8f5f]
*** 現在のプログラムの確認 [#x597dd0a]
 assoc .txt                  # => .txt=txtfile
 ftype txtfile               # => txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1
*** プログラムの変更 [#rcf81e8e]
 ftype txtfile="C:\App\gvim.exe" "%1"
拡張子.txtに関連付けられているプログラムをnotepad.exeからgvim.exeに変更する例。


** 参考 [#i56022cb]
- http://www.atmarkit.co.jp/fwin2k/win2ktips/841ftypes/ftypes.html
- http://blogs.technet.com/b/stanabe/archive/2010/05/25/handling-file-associations-with-command-line.aspx
- http://homepage2.nifty.com/suyamsoft/Registry/Explorer/Association/index.html
- http://ascii.jp/elem/000/001/195/1195074/

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS