- Сообщения
- 14,073
- Реакции
- 5,779
Файловые ассоциации в операционных системах
семейства Windows
семейства Windows
-Здравствуйте!У меня такая проблема-все ярлыки на рабочем столе открываются в блокноте...что посоветуете?
-Восстановление файловых ассоциаци...
Тема файловых ассоциаций наверное никогда не устареет и вроде уже избита и добавить особо нечего...но большинство людей знают лишь то,что при сбое ассоциации файл не будет открываться либо будет открываться не так как надо.
Причем в сети полно твиков\тем кратко и сухо излагающих общий обзор либо файлы исправления для скачивания.
В этой теме вопрос ассоциаций будет рассмотрен более детально,кроме того мы на практике попробуем создать собственное расширение и ассоциировать его,а так же добавим функциональные меню.
Итак...
Что такое файловая ассоциация?
В Википедии есть примерно такое определение:
Ассоциация или ассоциирование файлов — в программном обеспечении привязывание файла (по расширению или по каким-либо другим признакам) к прикладной программе, которая обрабатывает эти файлы. При «вызове» этого файла, например, в файловом менеджере, вызовется связанная с ним программа и откроет файл.
Для многих файлов существует несколько стандартных действий: например, графический файл можно просмотреть, отредактировать или распечатать. Обычно по двойному щелчку открывается быстрая программа просмотра графики, в то время как редактирование (требующее сложных, долго загружающихся программ наподобие Photoshop и GIMP) доступно не столь легко.
Тут, в принципе, и добавить нечего)))
Как это выглядит в жизни?
Откроем в редакторе реестра раздел HKCR.
Там мы видим длинный список расширений вида .XXX
Откройте любой из них,например .reg
Это ассоциация reg файла.
В правом окне редактора мы увидим какому типу файлов ассоциировано это расширение:

Это regfile.
Практика:
Получаем список файловых ассоциаций и сохраняем резервную копию для восстановления ассоциаций файлов в случае их нарушения.
Вот например я не хочу в случае нарушения ассоциации в массовом масштабе (например после вирусного заражения) возвращать значения на стандартные,хочу сразу получить свои любимые настройки.
Сделаем это.
Нажмите меню "Пуск"=>Введите cmd => По найденному объекту кликните правой кнопкой мыши и выберите пункт Запустить с правами администратора"
Далее вводим команду:
Код:
assoc
После этого в окне консоли появится список всех файловых расширений и сопоставленных им ассоциаций.
У меня так
Код:
.mp4=WMP11.AssocFile.MP4
.mp4v=WMP11.AssocFile.MP4
.mpa=WMP11.AssocFile.MPEG
.mpe=WMP11.AssocFile.MPEG
.mpeg=WMP11.AssocFile.MPEG
.mpf=MediaPackageFile
.mpg=WMP11.AssocFile.MPEG
.mpv2=WMP11.AssocFile.MPEG
.msc=MSCFile
.msdvd=Windows.DVD.Maker
.msg=Outlook.File.msg.14
.msi=Msi.Package
.msp=Msi.Patch
.msrcincident=RemoteAssistance.1
.msstyles=msstylesfile
.msu=Microsoft.System.Update.1
.mts=WMP11.AssocFile.M2TS
.mydocs=CLSID\{ECF03A32-103D-11d2-854D-006008059367}
.nfo=MSInfoFile
.nk2=Outlook.File.nk2.14
.ocx=ocxfile
.odc=odcfile
.odccubefile=odccubefile
.odcdatabasefile=odcdatabasefile
.odcnewfile=odcnewfile
.odctablefile=odctablefile
.odp=PowerPoint.OpenDocumentPresentation.12
.ods=Excel.OpenDocumentSpreadsheet.12
.odt=Word.OpenDocumentText.12
.ofs=Outlook.File.ofs.14
.oft=Outlook.File.oft.14
.ols=OfficeListShortcut
.one=OneNote.Section.1
.onepkg=OneNote.Package
.onetoc=OneNote.TableOfContents
.onetoc2=OneNote.TableOfContents.12
.opc=OPCFile
.oqy=oqyfile
.osdx=opensearchdescription
.ost=Outlook.File.ost.14
.otf=otffile
.otm=Outlook.File.otm.14
.ova=progId_VirtualBox.Shell.ova
.ovf=progId_VirtualBox.Shell.ovf
.p10=P10File
.p12=PFXFile
.p7b=SPCFile
.p7c=certificate_wab_auto_file
.p7m=P7MFile
.p7r=P7RFile
.p7s=P7SFile
.pab=Outlook.File.pab.14
.partial=IE.AssocFile.PARTIAL
.pbk=pbkfile
.pcb=PCBFile
.pdf=AcroExch.Document
.pdfxml=AcroExch.pdfxml
.pdx=PDXFileType
.perfmoncfg=Diagnostic.Perfmon.Config
.pfm=pfmfile
.pfx=PFXFile
.pif=piffile
.pko=PKOFile
.pnf=pnffile
.png=pngfile
.pot=PowerPoint.Template.8
.pothtml=powerpointhtmltemplate
.potm=PowerPoint.TemplateMacroEnabled.12
.potx=PowerPoint.Template.12
.ppa=PowerPoint.Addin.8
.ppam=PowerPoint.Addin.12
.pps=PowerPoint.SlideShow.8
.ppsm=PowerPoint.SlideShowMacroEnabled.12
.ppsx=PowerPoint.SlideShow.12
.ppt=PowerPoint.Show.8
.ppthtml=powerpointhtmlfile
.pptm=PowerPoint.ShowMacroEnabled.12
.pptmhtml=powerpointmhtmlfile
.pptx=PowerPoint.Show.12
.pptxml=powerpointxmlfile
.prf=prffile
.printerExport=brmFile
.ps1=Microsoft.PowerShellScript.1
.ps1xml=Microsoft.PowerShellXMLData.1
.psc1=Microsoft.PowerShellConsole.1
.psd1=Microsoft.PowerShellData.1
.psm1=Microsoft.PowerShellModule.1
.pst=Outlook.File.pst.14
.pub=Publisher.Document.14
.pubhtml=publisherhtmlfile
.pubmhtml=publishermhtmlfile
.PurblePairsSave-ms=MicrosoftPurblePairsSaveFile
.PurbleShopSave-ms=MicrosoftPurbleShopSaveFile
.pwz=PowerPoint.Wizard.8
.qds=SavedDsQuery
.r00=WinRAR
.r01=WinRAR
.r02=WinRAR
.r03=WinRAR
.r04=WinRAR
.r05=WinRAR
.r06=WinRAR
.r07=WinRAR
.r08=WinRAR
.r09=WinRAR
.r10=WinRAR
.r11=WinRAR
.r12=WinRAR
.r13=WinRAR
.r14=WinRAR
.r15=WinRAR
.r16=WinRAR
.r17=WinRAR
.r18=WinRAR
.r19=WinRAR
.r20=WinRAR
.r21=WinRAR
.r22=WinRAR
.r23=WinRAR
.r24=WinRAR
.r25=WinRAR
.r26=WinRAR
.r27=WinRAR
.r28=WinRAR
.r29=WinRAR
.rar=WinRAR
.rat=ratfile
.RDP=RDP.File
.reg=regfile
.rels=xmlfile
.resmoncfg=Diagnostic.Resmon.Config
.rev=WinRAR.REV
.rle=rlefile
.rll=dllfile
.rmi=WMP11.AssocFile.MIDI
.rqy=rqyfile
.rtf=Word.RTF.8
.SafeZone=SafeZone
.scf=SHCmdFile
.scp=txtfile
.scr=scrfile
.sct=scriptletfile
.sdf=Microsoft SQL Server Compact Edition Database File
.search-ms=SearchFolder
.searchConnector-ms=SearchConnectorFolder
.secstore=AcroExch.SecStore
.sfcache=RDBFileProperties.1
.shtml=shtmlfile
.sldm=PowerPoint.SlideMacroEnabled.12
.sldx=PowerPoint.Slide.12
.slk=Excel.SLK
.sln=VisualStudio.Launcher.sln
.slupkg-ms=MSSppPackageFile
.snd=WMP11.AssocFile.AU
.SolitaireSave-ms=MicrosoftSolitaireSaveFile
.spc=SPCFile
.SpiderSolitaireSave-ms=MicrosoftSpiderSolitaireSaveFile
.sst=CertificateStoreFile
.stl=STLFile
.suo=VisualStudio.Launcher.suo
.svg=svgfile
.sys=sysfile
.tar=WinRAR
.taz=WinRAR
.tbz=WinRAR
.tbz2=WinRAR
.tgz=WinRAR
.theme=themefile
.themepack=themepackfile
.thmx=OfficeTheme.12
.tif=TIFImage.Document
.tiff=TIFImage.Document
.ts=WMP11.AssocFile.TTS
.ttc=ttcfile
.ttf=ttffile
.tts=WMP11.AssocFile.TTS
.txt=txtfile
.UDL=MSDASC
.ui=UltraISO
.URL=InternetShortcut
.uu=WinRAR
.uue=WinRAR
.uxdc=UXDCFILE
.VBE=VBEFile
.vbox=progId_VirtualBox.Shell.vbox
.vbox-extpack=progId_VirtualBox.Shell.vbox-extpack
.vbs=VBSFile
.vcf=Outlook.File.vcf.14
.vcg=GrooveVCard
.vcs=Outlook.File.vcs.14
.vdi=progId_VirtualBox.Shell.vdi
.vdx=VisioViewer.Viewer
.vhd=progId_VirtualBox.Shell.vhd
.vmdk=progId_VirtualBox.Shell.vmdk
.vscontent=VisualStudio.ContentInstaller.vscontent
.vsd=VisioViewer.Viewer
.vsi=VisualStudio.ContentInstaller.vsi
.vss=VisioViewer.Viewer
.vst=VisioViewer.Viewer
.vsto=bootstrap.vsto.1
.vsx=VisioViewer.Viewer
.vtx=VisioViewer.Viewer
.vxd=vxdfile
.wab=wab_auto_file
.wav=WMP11.AssocFile.WAV
.wax=WMP11.AssocFile.WAX
.wbcat=wbcatfile
.wbk=Word.Backup.8
.wcx=wcxfile
.wdp=wdpfile
.webpnp=webpnpFile
.website=Microsoft.Website
.wiz=Word.Wizard.8
.wizhtml=accessthmltemplate
.wll=Word.Addin.8
.wm=WMP11.AssocFile.ASF
.wma=WMP11.AssocFile.WMA
.WMD=WMP11.AssocFile.WMD
.wmdb=WMP.WMDBFile
.wmf=wmffile
.WMS=WMP11.AssocFile.WMS
.wmv=WMP11.AssocFile.WMV
.wmx=WMP11.AssocFile.ASX
.wmz=WMP11.AssocFile.WMZ
.wpa=wpa.wpa_file
.wpl=WMP11.AssocFile.WPL
.wsc=scriptletfile
.WSF=WSFFile
.WSH=WSHFile
.WTV=MediaCenter.WTVFile
.wtx=txtfile
.wvx=WMP11.AssocFile.WVX
.xaml=Windows.XamlDocument
.xbap=Windows.Xbap
.xdp=AcroExch.XDPDoc
.xevgenxml=XEV.GenericApp
.xfdf=AcroExch.XFDFDoc
.xht=xhtmlfile
.xhtml=xhtmlfile
.xla=Excel.Addin
.xlam=Excel.AddInMacroEnabled
.xld=Excel.Dialog
.xlk=Excel.Backup
.xll=Excel.XLL
.xlm=Excel.Macrosheet
.xls=Excel.Sheet.8
.xlsb=Excel.SheetBinaryMacroEnabled.12
.xlshtml=Excelhtmlfile
.xlsm=Excel.SheetMacroEnabled.12
.xlsmhtml=excelmhtmlfile
.xlsx=Excel.Sheet.12
.xlt=Excel.Template.8
.xlthtml=Excelhtmltemplate
.xltm=Excel.TemplateMacroEnabled
.xltx=Excel.Template
.xlw=Excel.Workspace
.xlxml=Excelxmlss
.xml=xmlfile
.xps=Windows.XPSReachViewer
.xrm-ms=MSSppLicenseFile
.xsf=InfoPath.SolutionManifest.3
.xsl=xslfile
.xsn=InfoPath.Solution.3
.xtp=XTPFile
.xtp2=XTP2File
.xxe=WinRAR
.z=WinRAR
.zfsendtotarget=CLSID\{888DCA60-FC0A-11CF-8F0F-00C04FD7D062}
.zip=WinRAR.ZIP
._sln=VisualStudio.Launcher._sln
._sln60=VisualStudio.Launcher._sln60
._sln70=VisualStudio.Launcher._sln70
._sln71=VisualStudio.Launcher._sln71
._sln80=VisualStudio.Launcher._sln80
._vbxsln80=VisualStudio.Launcher._vbxsln80
._vcppxsln80=VisualStudio.Launcher._vcppxsln80
._vcsxsln80=VisualStudio.Launcher._vcsxsln80
._vjsxsln80=VisualStudio.Launcher._vjsxsln80
._vstasln80=VisualStudio.Launcher._vstasln80
._vwdxsln80=VisualStudio.Launcher._vwdxsln80
Но такой абракадабры недостаточно-не вручную же потом переписывать,правильно?
Сделаем ход конем-запустим скрипт,который добавит знак табуляции в каждую строку первым символом,а затем заменим знак табуляции на команду assoc.
Код:
@echo off
SetLocal EnableExtensions
(
For /F "delims=" %%? in ('assoc') do echo assoc %%?
) >%userprofile%\documents\myassoc.cmd
.mp4=WMP11.AssocFile.MP4
.mp4v=WMP11.AssocFile.MP4
.mpa=WMP11.AssocFile.MPEG
.mpe=WMP11.AssocFile.MPEG
.mpeg=WMP11.AssocFile.MPEG
.mpf=MediaPackageFile
.mpg=WMP11.AssocFile.MPEG
.mpv2=WMP11.AssocFile.MPEG
.msc=MSCFile
.msdvd=Windows.DVD.Maker
.msg=Outlook.File.msg.14
.msi=Msi.Package
.msp=Msi.Patch
.msrcincident=RemoteAssistance.1
.msstyles=msstylesfile
.msu=Microsoft.System.Update.1
.mts=WMP11.AssocFile.M2TS
.mydocs=CLSID\{ECF03A32-103D-11d2-854D-006008059367}
.nfo=MSInfoFile
.nk2=Outlook.File.nk2.14
.ocx=ocxfile
.odc=odcfile
.odccubefile=odccubefile
.odcdatabasefile=odcdatabasefile
.odcnewfile=odcnewfile
.odctablefile=odctablefile
.odp=PowerPoint.OpenDocumentPresentation.12
.ods=Excel.OpenDocumentSpreadsheet.12
.odt=Word.OpenDocumentText.12
.ofs=Outlook.File.ofs.14
.oft=Outlook.File.oft.14
.ols=OfficeListShortcut
.one=OneNote.Section.1
.onepkg=OneNote.Package
.onetoc=OneNote.TableOfContents
.onetoc2=OneNote.TableOfContents.12
.opc=OPCFile
.oqy=oqyfile
.osdx=opensearchdescription
.ost=Outlook.File.ost.14
.otf=otffile
.otm=Outlook.File.otm.14
.ova=progId_VirtualBox.Shell.ova
.ovf=progId_VirtualBox.Shell.ovf
.p10=P10File
.p12=PFXFile
.p7b=SPCFile
.p7c=certificate_wab_auto_file
.p7m=P7MFile
.p7r=P7RFile
.p7s=P7SFile
.pab=Outlook.File.pab.14
.partial=IE.AssocFile.PARTIAL
.pbk=pbkfile
.pcb=PCBFile
.pdf=AcroExch.Document
.pdfxml=AcroExch.pdfxml
.pdx=PDXFileType
.perfmoncfg=Diagnostic.Perfmon.Config
.pfm=pfmfile
.pfx=PFXFile
.pif=piffile
.pko=PKOFile
.pnf=pnffile
.png=pngfile
.pot=PowerPoint.Template.8
.pothtml=powerpointhtmltemplate
.potm=PowerPoint.TemplateMacroEnabled.12
.potx=PowerPoint.Template.12
.ppa=PowerPoint.Addin.8
.ppam=PowerPoint.Addin.12
.pps=PowerPoint.SlideShow.8
.ppsm=PowerPoint.SlideShowMacroEnabled.12
.ppsx=PowerPoint.SlideShow.12
.ppt=PowerPoint.Show.8
.ppthtml=powerpointhtmlfile
.pptm=PowerPoint.ShowMacroEnabled.12
.pptmhtml=powerpointmhtmlfile
.pptx=PowerPoint.Show.12
.pptxml=powerpointxmlfile
.prf=prffile
.printerExport=brmFile
.ps1=Microsoft.PowerShellScript.1
.ps1xml=Microsoft.PowerShellXMLData.1
.psc1=Microsoft.PowerShellConsole.1
.psd1=Microsoft.PowerShellData.1
.psm1=Microsoft.PowerShellModule.1
.pst=Outlook.File.pst.14
.pub=Publisher.Document.14
.pubhtml=publisherhtmlfile
.pubmhtml=publishermhtmlfile
.PurblePairsSave-ms=MicrosoftPurblePairsSaveFile
.PurbleShopSave-ms=MicrosoftPurbleShopSaveFile
.pwz=PowerPoint.Wizard.8
.qds=SavedDsQuery
.r00=WinRAR
.r01=WinRAR
.r02=WinRAR
.r03=WinRAR
.r04=WinRAR
.r05=WinRAR
.r06=WinRAR
.r07=WinRAR
.r08=WinRAR
.r09=WinRAR
.r10=WinRAR
.r11=WinRAR
.r12=WinRAR
.r13=WinRAR
.r14=WinRAR
.r15=WinRAR
.r16=WinRAR
.r17=WinRAR
.r18=WinRAR
.r19=WinRAR
.r20=WinRAR
.r21=WinRAR
.r22=WinRAR
.r23=WinRAR
.r24=WinRAR
.r25=WinRAR
.r26=WinRAR
.r27=WinRAR
.r28=WinRAR
.r29=WinRAR
.rar=WinRAR
.rat=ratfile
.RDP=RDP.File
.reg=regfile
.rels=xmlfile
.resmoncfg=Diagnostic.Resmon.Config
.rev=WinRAR.REV
.rle=rlefile
.rll=dllfile
.rmi=WMP11.AssocFile.MIDI
.rqy=rqyfile
.rtf=Word.RTF.8
.SafeZone=SafeZone
.scf=SHCmdFile
.scp=txtfile
.scr=scrfile
.sct=scriptletfile
.sdf=Microsoft SQL Server Compact Edition Database File
.search-ms=SearchFolder
.searchConnector-ms=SearchConnectorFolder
.secstore=AcroExch.SecStore
.sfcache=RDBFileProperties.1
.shtml=shtmlfile
.sldm=PowerPoint.SlideMacroEnabled.12
.sldx=PowerPoint.Slide.12
.slk=Excel.SLK
.sln=VisualStudio.Launcher.sln
.slupkg-ms=MSSppPackageFile
.snd=WMP11.AssocFile.AU
.SolitaireSave-ms=MicrosoftSolitaireSaveFile
.spc=SPCFile
.SpiderSolitaireSave-ms=MicrosoftSpiderSolitaireSaveFile
.sst=CertificateStoreFile
.stl=STLFile
.suo=VisualStudio.Launcher.suo
.svg=svgfile
.sys=sysfile
.tar=WinRAR
.taz=WinRAR
.tbz=WinRAR
.tbz2=WinRAR
.tgz=WinRAR
.theme=themefile
.themepack=themepackfile
.thmx=OfficeTheme.12
.tif=TIFImage.Document
.tiff=TIFImage.Document
.ts=WMP11.AssocFile.TTS
.ttc=ttcfile
.ttf=ttffile
.tts=WMP11.AssocFile.TTS
.txt=txtfile
.UDL=MSDASC
.ui=UltraISO
.URL=InternetShortcut
.uu=WinRAR
.uue=WinRAR
.uxdc=UXDCFILE
.VBE=VBEFile
.vbox=progId_VirtualBox.Shell.vbox
.vbox-extpack=progId_VirtualBox.Shell.vbox-extpack
.vbs=VBSFile
.vcf=Outlook.File.vcf.14
.vcg=GrooveVCard
.vcs=Outlook.File.vcs.14
.vdi=progId_VirtualBox.Shell.vdi
.vdx=VisioViewer.Viewer
.vhd=progId_VirtualBox.Shell.vhd
.vmdk=progId_VirtualBox.Shell.vmdk
.vscontent=VisualStudio.ContentInstaller.vscontent
.vsd=VisioViewer.Viewer
.vsi=VisualStudio.ContentInstaller.vsi
.vss=VisioViewer.Viewer
.vst=VisioViewer.Viewer
.vsto=bootstrap.vsto.1
.vsx=VisioViewer.Viewer
.vtx=VisioViewer.Viewer
.vxd=vxdfile
.wab=wab_auto_file
.wav=WMP11.AssocFile.WAV
.wax=WMP11.AssocFile.WAX
.wbcat=wbcatfile
.wbk=Word.Backup.8
.wcx=wcxfile
.wdp=wdpfile
.webpnp=webpnpFile
.website=Microsoft.Website
.wiz=Word.Wizard.8
.wizhtml=accessthmltemplate
.wll=Word.Addin.8
.wm=WMP11.AssocFile.ASF
.wma=WMP11.AssocFile.WMA
.WMD=WMP11.AssocFile.WMD
.wmdb=WMP.WMDBFile
.wmf=wmffile
.WMS=WMP11.AssocFile.WMS
.wmv=WMP11.AssocFile.WMV
.wmx=WMP11.AssocFile.ASX
.wmz=WMP11.AssocFile.WMZ
.wpa=wpa.wpa_file
.wpl=WMP11.AssocFile.WPL
.wsc=scriptletfile
.WSF=WSFFile
.WSH=WSHFile
.WTV=MediaCenter.WTVFile
.wtx=txtfile
.wvx=WMP11.AssocFile.WVX
.xaml=Windows.XamlDocument
.xbap=Windows.Xbap
.xdp=AcroExch.XDPDoc
.xevgenxml=XEV.GenericApp
.xfdf=AcroExch.XFDFDoc
.xht=xhtmlfile
.xhtml=xhtmlfile
.xla=Excel.Addin
.xlam=Excel.AddInMacroEnabled
.xld=Excel.Dialog
.xlk=Excel.Backup
.xll=Excel.XLL
.xlm=Excel.Macrosheet
.xls=Excel.Sheet.8
.xlsb=Excel.SheetBinaryMacroEnabled.12
.xlshtml=Excelhtmlfile
.xlsm=Excel.SheetMacroEnabled.12
.xlsmhtml=excelmhtmlfile
.xlsx=Excel.Sheet.12
.xlt=Excel.Template.8
.xlthtml=Excelhtmltemplate
.xltm=Excel.TemplateMacroEnabled
.xltx=Excel.Template
.xlw=Excel.Workspace
.xlxml=Excelxmlss
.xml=xmlfile
.xps=Windows.XPSReachViewer
.xrm-ms=MSSppLicenseFile
.xsf=InfoPath.SolutionManifest.3
.xsl=xslfile
.xsn=InfoPath.Solution.3
.xtp=XTPFile
.xtp2=XTP2File
.xxe=WinRAR
.z=WinRAR
.zfsendtotarget=CLSID\{888DCA60-FC0A-11CF-8F0F-00C04FD7D062}
.zip=WinRAR.ZIP
._sln=VisualStudio.Launcher._sln
._sln60=VisualStudio.Launcher._sln60
._sln70=VisualStudio.Launcher._sln70
._sln71=VisualStudio.Launcher._sln71
._sln80=VisualStudio.Launcher._sln80
._vbxsln80=VisualStudio.Launcher._vbxsln80
._vcppxsln80=VisualStudio.Launcher._vcppxsln80
._vcsxsln80=VisualStudio.Launcher._vcsxsln80
._vjsxsln80=VisualStudio.Launcher._vjsxsln80
._vstasln80=VisualStudio.Launcher._vstasln80
._vwdxsln80=VisualStudio.Launcher._vwdxsln80
Просто добавили в список полученных командой assoc ассоциации код
Код:
@echo off
SetLocal EnableExtensions
(
For /F "delims=" %%? in ('assoc') do echo assoc %%?
) > myassoc.cmd
Запустив этот файл от имени администратора мы восстановим все ассоциации сохраненные скриптом.
И вот уже получилось гораздо интереснее:
Код:
assoc.mp4=WMP11.AssocFile.MP4
assoc.mp4v=WMP11.AssocFile.MP4
assoc.mpa=WMP11.AssocFile.MPEG
assoc.mpe=WMP11.AssocFile.MPEG
assoc.mpeg=WMP11.AssocFile.MPEG
assoc.mpf=MediaPackageFile
assoc.mpg=WMP11.AssocFile.MPEG
assoc.mpv2=WMP11.AssocFile.MPEG
assoc.msc=MSCFile
assoc.msdvd=Windows.DVD.Maker
assoc.msg=Outlook.File.msg.14
assoc.msi=Msi.Package
assoc.msp=Msi.Patch
assoc.msrcincident=RemoteAssistance.1
assoc.msstyles=msstylesfile
assoc.msu=Microsoft.System.Update.1
assoc.mts=WMP11.AssocFile.M2TS
assoc.mydocs=CLSID\{ECF03A32-103D-11d2-854D-006008059367}
assoc.nfo=MSInfoFile
assoc.nk2=Outlook.File.nk2.14
assoc.ocx=ocxfile
assoc.odc=odcfile
assoc.odccubefile=odccubefile
assoc.odcdatabasefile=odcdatabasefile
assoc.odcnewfile=odcnewfile
assoc.odctablefile=odctablefile
assoc.odp=PowerPoint.OpenDocumentPresentation.12
assoc.ods=Excel.OpenDocumentSpreadsheet.12
assoc.odt=Word.OpenDocumentText.12
assoc.ofs=Outlook.File.ofs.14
assoc.oft=Outlook.File.oft.14
assoc.ols=OfficeListShortcut
assoc.one=OneNote.Section.1
assoc.onepkg=OneNote.Package
assoc.onetoc=OneNote.TableOfContents
assoc.onetoc2=OneNote.TableOfContents.12
assoc.opc=OPCFile
assoc.oqy=oqyfile
assoc.osdx=opensearchdescription
assoc.ost=Outlook.File.ost.14
assoc.otf=otffile
assoc.otm=Outlook.File.otm.14
assoc.ova=progId_VirtualBox.Shell.ova
assoc.ovf=progId_VirtualBox.Shell.ovf
assoc.p10=P10File
assoc.p12=PFXFile
assoc.p7b=SPCFile
assoc.p7c=certificate_wab_auto_file
assoc.p7m=P7MFile
assoc.p7r=P7RFile
assoc.p7s=P7SFile
assoc.pab=Outlook.File.pab.14
assoc.partial=IE.AssocFile.PARTIAL
assoc.pbk=pbkfile
assoc.pcb=PCBFile
assoc.pdf=AcroExch.Document
assoc.pdfxml=AcroExch.pdfxml
assoc.pdx=PDXFileType
assoc.perfmoncfg=Diagnostic.Perfmon.Config
assoc.pfm=pfmfile
assoc.pfx=PFXFile
assoc.pif=piffile
assoc.pko=PKOFile
assoc.pnf=pnffile
assoc.png=pngfile
assoc.pot=PowerPoint.Template.8
assoc.pothtml=powerpointhtmltemplate
assoc.potm=PowerPoint.TemplateMacroEnabled.12
assoc.potx=PowerPoint.Template.12
assoc.ppa=PowerPoint.Addin.8
assoc.ppam=PowerPoint.Addin.12
assoc.pps=PowerPoint.SlideShow.8
assoc.ppsm=PowerPoint.SlideShowMacroEnabled.12
assoc.ppsx=PowerPoint.SlideShow.12
assoc.ppt=PowerPoint.Show.8
assoc.ppthtml=powerpointhtmlfile
assoc.pptm=PowerPoint.ShowMacroEnabled.12
assoc.pptmhtml=powerpointmhtmlfile
assoc.pptx=PowerPoint.Show.12
assoc.pptxml=powerpointxmlfile
assoc.prf=prffile
assoc.printerExport=brmFile
assoc.ps1=Microsoft.PowerShellScript.1
assoc.ps1xml=Microsoft.PowerShellXMLData.1
assoc.psc1=Microsoft.PowerShellConsole.1
assoc.psd1=Microsoft.PowerShellData.1
assoc.psm1=Microsoft.PowerShellModule.1
assoc.pst=Outlook.File.pst.14
assoc.pub=Publisher.Document.14
assoc.pubhtml=publisherhtmlfile
assoc.pubmhtml=publishermhtmlfile
assoc.PurblePairsSave-ms=MicrosoftPurblePairsSaveFile
assoc.PurbleShopSave-ms=MicrosoftPurbleShopSaveFile
assoc.pwz=PowerPoint.Wizard.8
assoc.qds=SavedDsQuery
assoc.r00=WinRAR
assoc.r01=WinRAR
assoc.r02=WinRAR
assoc.r03=WinRAR
assoc.r04=WinRAR
assoc.r05=WinRAR
assoc.r06=WinRAR
assoc.r07=WinRAR
assoc.r08=WinRAR
assoc.r09=WinRAR
assoc.r10=WinRAR
assoc.r11=WinRAR
assoc.r12=WinRAR
assoc.r13=WinRAR
assoc.r14=WinRAR
assoc.r15=WinRAR
assoc.r16=WinRAR
assoc.r17=WinRAR
assoc.r18=WinRAR
assoc.r19=WinRAR
assoc.r20=WinRAR
assoc.r21=WinRAR
assoc.r22=WinRAR
assoc.r23=WinRAR
assoc.r24=WinRAR
assoc.r25=WinRAR
assoc.r26=WinRAR
assoc.r27=WinRAR
assoc.r28=WinRAR
assoc.r29=WinRAR
assoc.rar=WinRAR
assoc.rat=ratfile
assoc.RDP=RDP.File
assoc.reg=regfile
assoc.rels=xmlfile
assoc.resmoncfg=Diagnostic.Resmon.Config
assoc.rev=WinRAR.REV
assoc.rle=rlefile
assoc.rll=dllfile
assoc.rmi=WMP11.AssocFile.MIDI
assoc.rqy=rqyfile
assoc.rtf=Word.RTF.8
assoc.SafeZone=SafeZone
assoc.scf=SHCmdFile
assoc.scp=txtfile
assoc.scr=scrfile
assoc.sct=scriptletfile
assoc.sdf=Microsoft SQL Server Compact Edition Database File
assoc.search-ms=SearchFolder
assoc.searchConnector-ms=SearchConnectorFolder
assoc.secstore=AcroExch.SecStore
assoc.sfcache=RDBFileProperties.1
assoc.shtml=shtmlfile
assoc.sldm=PowerPoint.SlideMacroEnabled.12
assoc.sldx=PowerPoint.Slide.12
assoc.slk=Excel.SLK
assoc.sln=VisualStudio.Launcher.sln
assoc.slupkg-ms=MSSppPackageFile
assoc.snd=WMP11.AssocFile.AU
assoc.SolitaireSave-ms=MicrosoftSolitaireSaveFile
assoc.spc=SPCFile
assoc.SpiderSolitaireSave-ms=MicrosoftSpiderSolitaireSaveFile
assoc.sst=CertificateStoreFile
assoc.stl=STLFile
assoc.suo=VisualStudio.Launcher.suo
assoc.svg=svgfile
assoc.sys=sysfile
assoc.tar=WinRAR
assoc.taz=WinRAR
assoc.tbz=WinRAR
assoc.tbz2=WinRAR
assoc.tgz=WinRAR
assoc.theme=themefile
assoc.themepack=themepackfile
assoc.thmx=OfficeTheme.12
assoc.tif=TIFImage.Document
assoc.tiff=TIFImage.Document
assoc.ts=WMP11.AssocFile.TTS
assoc.ttc=ttcfile
assoc.ttf=ttffile
assoc.tts=WMP11.AssocFile.TTS
assoc.txt=txtfile
assoc.UDL=MSDASC
assoc.ui=UltraISO
assoc.URL=InternetShortcut
assoc.uu=WinRAR
assoc.uue=WinRAR
assoc.uxdc=UXDCFILE
assoc.VBE=VBEFile
assoc.vbox=progId_VirtualBox.Shell.vbox
assoc.vbox-extpack=progId_VirtualBox.Shell.vbox-extpack
assoc.vbs=VBSFile
assoc.vcf=Outlook.File.vcf.14
assoc.vcg=GrooveVCard
assoc.vcs=Outlook.File.vcs.14
assoc.vdi=progId_VirtualBox.Shell.vdi
assoc.vdx=VisioViewer.Viewer
assoc.vhd=progId_VirtualBox.Shell.vhd
assoc.vmdk=progId_VirtualBox.Shell.vmdk
assoc.vscontent=VisualStudio.ContentInstaller.vscontent
assoc.vsd=VisioViewer.Viewer
assoc.vsi=VisualStudio.ContentInstaller.vsi
assoc.vss=VisioViewer.Viewer
assoc.vst=VisioViewer.Viewer
assoc.vsto=bootstrap.vsto.1
assoc.vsx=VisioViewer.Viewer
assoc.vtx=VisioViewer.Viewer
assoc.vxd=vxdfile
assoc.wab=wab_auto_file
assoc.wav=WMP11.AssocFile.WAV
assoc.wax=WMP11.AssocFile.WAX
assoc.wbcat=wbcatfile
assoc.wbk=Word.Backup.8
assoc.wcx=wcxfile
assoc.wdp=wdpfile
assoc.webpnp=webpnpFile
assoc.website=Microsoft.Website
assoc.wiz=Word.Wizard.8
assoc.wizhtml=accessthmltemplate
assoc.wll=Word.Addin.8
assoc.wm=WMP11.AssocFile.ASF
assoc.wma=WMP11.AssocFile.WMA
assoc.WMD=WMP11.AssocFile.WMD
assoc.wmdb=WMP.WMDBFile
assoc.wmf=wmffile
assoc.WMS=WMP11.AssocFile.WMS
assoc.wmv=WMP11.AssocFile.WMV
assoc.wmx=WMP11.AssocFile.ASX
assoc.wmz=WMP11.AssocFile.WMZ
assoc.wpa=wpa.wpa_file
assoc.wpl=WMP11.AssocFile.WPL
assoc.wsc=scriptletfile
assoc.WSF=WSFFile
assoc.WSH=WSHFile
assoc.WTV=MediaCenter.WTVFile
assoc.wtx=txtfile
assoc.wvx=WMP11.AssocFile.WVX
assoc.xaml=Windows.XamlDocument
assoc.xbap=Windows.Xbap
assoc.xdp=AcroExch.XDPDoc
assoc.xevgenxml=XEV.GenericApp
assoc.xfdf=AcroExch.XFDFDoc
assoc.xht=xhtmlfile
assoc.xhtml=xhtmlfile
assoc.xla=Excel.Addin
assoc.xlam=Excel.AddInMacroEnabled
assoc.xld=Excel.Dialog
assoc.xlk=Excel.Backup
assoc.xll=Excel.XLL
assoc.xlm=Excel.Macrosheet
assoc.xls=Excel.Sheet.8
assoc.xlsb=Excel.SheetBinaryMacroEnabled.12
assoc.xlshtml=Excelhtmlfile
assoc.xlsm=Excel.SheetMacroEnabled.12
assoc.xlsmhtml=excelmhtmlfile
assoc.xlsx=Excel.Sheet.12
assoc.xlt=Excel.Template.8
assoc.xlthtml=Excelhtmltemplate
assoc.xltm=Excel.TemplateMacroEnabled
assoc.xltx=Excel.Template
assoc.xlw=Excel.Workspace
assoc.xlxml=Excelxmlss
assoc.xml=xmlfile
assoc.xps=Windows.XPSReachViewer
assoc.xrm-ms=MSSppLicenseFile
assoc.xsf=InfoPath.SolutionManifest.3
assoc.xsl=xslfile
assoc.xsn=InfoPath.Solution.3
assoc.xtp=XTPFile
assoc.xtp2=XTP2File
assoc.xxe=WinRAR
assoc.z=WinRAR
assoc.zfsendtotarget=CLSID\{888DCA60-FC0A-11CF-8F0F-00C04FD7D062}
assoc.zip=WinRAR.ZIP
assoc._sln=VisualStudio.Launcher._sln
assoc._sln60=VisualStudio.Launcher._sln60
assoc._sln70=VisualStudio.Launcher._sln70
assoc._sln71=VisualStudio.Launcher._sln71
assoc._sln80=VisualStudio.Launcher._sln80
assoc._vbxsln80=VisualStudio.Launcher._vbxsln80
assoc._vcppxsln80=VisualStudio.Launcher._vcppxsln80
assoc._vcsxsln80=VisualStudio.Launcher._vcsxsln80
assoc._vjsxsln80=VisualStudio.Launcher._vjsxsln80
assoc._vstasln80=VisualStudio.Launcher._vstasln80
assoc._vwdxsln80=VisualStudio.Launcher._vwdxsln80
Теперь сохраняем это все в bat-файл и теперь я в любой момент в два клика мышкой восстановлю свой ассоциации.
Точно так же можно точечно изменять какие либо конкретные ассоциации.
Либо можно воспользоваться твиками из этой темы:
Восстановление файловых ассоциаций
Тут вроде понятно...но и что с того что regfile? Выше мы определили принадлежность ассоциированного расширения к этому типу файлов.
Как система должна понять каким приложением открыть такой файл?
Тут в на сцене появляется Prog Id.
Система использует разделы и параметры реестра программных идентификаторов (programatic identifier или ProgID), чтобы ассоциировать тип файла с приложением, и чтобы контролировать поведение ассоциации. Записи ProgID, используемые для файловых ассоциаций, хранятся в параметре раздела реестра HKEY_CLASSES_ROOT.
Они имеют примерно такой вид:

То есть фалы с расширением .txt (по образцу из начала темы) ассоциированы с файлами типа txtfile,а файлы типа txtfile являются текстовыми файлами и обрабатываются блокнотом.
Это мы видим на скринах

Практика:
Создаем собственное расширение и задаем ему ассоциацию.
Представим ,что мы написали какую нибудь программу.
Ну например пусть это будет уже известная софтина,скажем, Notepad++
предположим что эта программа работает с файлами собственного расширения,как указать системе,что эти файлы должны открываться программой Notepad++ ?
Создадим для него раздел Progid.
Код:
HKCR\SafeZone
Код:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SafeZone]
@=""
"EditFlags"="0x00008000"
[HKEY_CLASSES_ROOT\SafeZone\DefaultIcon]
@="D:\\Program Files\\Notepad++\\Notepad++.exe"
[HKEY_CLASSES_ROOT\SafeZone\shell]
[HKEY_CLASSES_ROOT\SafeZone\shell\open]
[HKEY_CLASSES_ROOT\SafeZone\shell\open\command]
@=""D:\\Program Files\\Notepad++\\Notepad++.exe\" %1"

Поясню что и как.
Создаем раздел
А в нем подразделы[HKEY_CLASSES_ROOT\SafeZone]
Код:
[HKEY_CLASSES_ROOT\SafeZone\DefaultIcon]
Код:
[HKEY_CLASSES_ROOT\SafeZone\shell]
[HKEY_CLASSES_ROOT\SafeZone\shell\open]
[HKEY_CLASSES_ROOT\SafeZone\shell\open\command]
Соответственно shell добавляет диалоговое меню для работы с расширением из контексного меню.
Open-зарезервированный глагол (о глаголах не в этой теме),открытие файла.
Command-задает команду консоли выполнения действия при открытии файла.
в нашем случае это
Код:
@="\"D:\\Program Files\\Notepad++\\Notepad++.exe\" %1
А что за EditFlags?
Это флаги реестра,наборы инструкций -флагам я планирую посвятить отдельно несколько тем.
Полный перечень применимых флагов для расширений будет выложен там же.
Вот таблица возможных значений:
(Default)(До Windows 2000) | Это необязательное значение,которое ко всему прочему еще и устарело. Установите значение по-умолчанию для ProgID в название формата файлов для этого ProgID, пригодное для показа пользователю. Это поле устарело в Windows 2000 и выше. Вместо него лучше использовать значение FriendlyName (см. ниже). Тем не менее, вы должны установить это поле для совместимости со старыми программами. Для согласованности - здесь должны быть те же данные, что и в поле FriendlyName (но только для одного языка).
AppUserModelID (Windows 7 и выше)| Это необязательное значение идентификатор модели пользователя приложения (Application User Model ID, AppUserModelID), если приложение использует явный (explicit) AppUserModelID и использует либо автоматически сгенерированные системой Jump-списки Недавние или Часто используемые или предоставляет свой Jump-список. Если приложение использует явный AppUserModelID, но не устанавливает это значение, то элементы не будут появляться в Jump-списках этого приложения. Это строка типа REG_SZ.
EditFlags | Это необязательное значение, используются флаги . Запись EditFlags контролирует некоторые аспекты в обработке типа файла, ассоциированного с этим ProgID, Оболочкой. Вы также можете использовать запись EditFlags, чтобы ограничить возможность изменения некоторых аспектов этих файловых типов пользователем. Значения флагов, используемые для EditFlags, являются двоичными значениями, предназначенными для комбинирования с использованием логической операции ИЛИ. Это значение может иметь тип REG_DWORD или REG_BINARY.
FriendlyTypeName| Установите в эту запись название типа файлов (friendly name) этого ProgID, пригодного к показу пользователю. Для согласованности - здесь должны быть те же данные, что и в значении по-умолчанию (см. выше). Эта запись может быть типа REG_SZ или REG_EXPAND_SZ, но должна быть оформлена как косвенная строка (indirect string) - т.е. полное имя файла и значение ресурса, с ведомым @, например: @%SystemRoot%\shell32.dll,-267.
InfoTip| Установите в эту запись краткое описание, которое Оболочка будет показывать для этого ProgID. Запись InfoTip показывается, когда пользователь задерживает мышь над файлом этого типа. Это значение может иметь тип REG_SZ или REG_EXPAND_SZ, но, как и FriendlyTypeName, оно должно быть косвенной строкой.
CurVer | Установите запись по-умолчанию этого подключа на самую последнюю версию ProgID.
Примечание: если только вы не разрабатываете side-by-side приложение (т.е. приложение, которое допускает одновременную установку нескольких своих различных версий на одну машину), то вам не следует использовать запись CurVer.
DefaultIcon.| Установите значение по-умолчанию этого раздела=путь к иконке которую вы хотите показывать для файловых типов, ассоциированных с этим ProgID. Это значение может быть либо REG_SZ, либо REG_EXPAND_SZ, но оно должно иметь формат полного имени файла со значением ресурса через запятую, например: %SystemRoot%\shell32.dll,-267.
Далее необходимо задать ассоциацию расширению файла.
Код:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.SafeZone]
@="SafeZone"
"EditFlags"="0x00008000"
Код:
[HKEY_CLASSES_ROOT\.SafeZone\ShellNew]
"NullFile"=""
@=""
"FileName"="D:\\Windows\\ShellNew\\NewFile.SafeZone"
Тут подробности:
Код:
[HKEY_CLASSES_ROOT\.SafeZone]
@="SafeZone"
Код:
[HKEY_CLASSES_ROOT\.SafeZone\ShellNew]
"NullFile"=""
@=""
"FileName"="D:\\Windows\\ShellNew\\NewFile.SafeZone"
И вот у меня в системе уже появился первый образец файла:

И открывается он программой Notepad++

Дополнительные вопросы и обсуждение темы:
https://safezone.cc/threads/voprosy-k-state-fajlovye-associacii-znakomimsja-na-praktike.22970/
Последнее редактирование: