コマンドラインで、ファイルの関連付けを操作する方法
?????????????????????????? TechNet Magazine ???????????????????
Tip: Examine File Extensions and File Associations in Windows 7 (??)
https://technet.microsoft.com/en-us/magazine/ff687021.aspx
???????assoc ???????(??????????????????)??????????????????????????????
C:\>assoc /?
????????????????????????
ASSOC [.???[=[???? ???]]]
.??? ???? ???????????????????
???? ??? ????????????? ??????????
??????????????ASSOC????????????????????
??????????????????? ASSOC ?????????????
??????????????????????????? ????????
?????????????????????????????
C:\>assoc .doc
.doc=Word.Document.8
????? .doc ????????Word.Document.8 ???????????????????????? Word.Document.8 ??????????????????????????????????? ftype ????(??????????????????)???
C:\>ftype /?
????????????????????? ???????????????
FTYPE [???? ???[=[???????????]]]
???? ??? ????????????? ??????????
??????????? ???????????????????????
??????
??????????????FTYPE???????????? ???????
??????????????? ?????????????? ???
??????? FTYPE ????????????? ???????????
?????????????????? ???????????????
???????? ???????? ??????????????
???? ?????? %0 ??? %1 ??????????????
???????????????%* ????????????????
%2 ?? 1 ???????%3 ?? 2 ?????????????%~n ??
? n ??????????????????????????n ??2 ?? 9
??????????
ASSOC .pl=PerlScript
FTYPE PerlScript=perl.exe %1 %*
???????????? Perl ?????????????
script.pl 1 2 3
???????????????????????????
set PATHEXT=.pl;%PATHEXT%
???????????????????????????
script 1 2 3
C:\>ftype Word.Document.8
Word.Document.8="C:\Program Files\Microsoft Office\Office14\WINWORD.EXE" /n "%1"
?????????????????????????????????assoc, ftype ???????????????????????????????????
????? PowerShell ???????????????assoc, ftype ???????????????????????PowerShell ???????????????????????????????
PS C:\> cmd /c assoc .doc
.doc=Word.Document.8
PowerShell ???"=" ???????????????????????????????
PS C:\> $assoc = $null
PS C:\> (cmd /c assoc) | %{$a=$_.split("="); $assoc += @{$a[0]=$a[1]}}
PS C:\> $assoc[".doc"]
Word.Document.8
ftype ??????
PS C:\> $ftype = $null
PS C:\> (cmd /c ftype) | %{$f=$_.split("="); $ftype += @{$f[0]=$f[1]}}
PS C:\> $ftype["Word.Document.8"]
"C:\Program Files\Microsoft Office\Office14\WINWORD.EXE" /n "%1"
????????????????????????
PS C:\> $assoc | ft Name, {$ftype[$_.Value]}
Name $ftype[$_.Value]
---- ----------------
._vbxsln80
.fsx "E:\apps\Microsoft Visual Studio 10....
.cda "%ProgramFiles%\Windows Media Player...
.htx
.svclog "C:\Program Files\Microsoft SDKs\Win...
.spdesignunknown "C:\Program Files\Microsoft Office\O...
.iso "e:\apps\Elaborate Bytes\VirtualClon...
.vsixmanifest "E:\apps\Microsoft Visual Studio 10..…
(??)
?????????????????????????????????????????????????????????????????????????????assoc, ftype ? Windows NT ????????????????