ファイル拡張子の関連付けを変更する


1

一度に複数のファイル拡張子の関連付け(開くプログラムなど)を永続的に変更する最も簡単な方法は何ですか?

私が意味したのは?

txtdatbatおよびabcファイルを開くために、これまでTextEditorUncoolを使用したとしましょう。これでTextEditorReallyCoolが得られ、左側にプログラムの名前があり、右側にそれに関連付けられたファイル拡張子のリストがあるアプリケーション(たとえば、開くアプリケーション)があればいいのにと思います。

そのようなことはありますか?

通常、プログラムはインストール中にこのことを変更します(前もって尋ねる人もいます)が、ポータブルプログラムの場合、通常は手作業で行う必要があります。

すべてのアイデアを歓迎します!

回答:


1

約1年前、このようなテキストファイルの関連付けの問題に対処するための小さなバッチスクリプトを作成しました。私はほとんどの時間で働いていますが、時々(たとえば、Windowsの更新が適用された後)、関連付けがデフォルトに復元され、それが起こった場合、バッチを再度実行します。

バッチスクリプトで3つのお気に入りのテキストエディターを選択しました。

  • 軽量テキストファイル用のNotepad2(またはNotepad2-mod)。デフォルトのインストールディレクトリ:%SystemRoot%
  • .sql .shのNotepad ++。デフォルトのインストールディレクトリ:%ProgramFiles%\Notepad++
  • ほとんどのプログラミング言語のテキストファイル用のEditPlus。デフォルトのインストールディレクトリ:%ProgramFiles%\EditPlus 3

好みのテキストエディターに変更し、対応するファイルタイプを自分のものに変更する必要があります。

@echo off

echo --------------------------------------------------------------------------
echo Windows text file association
echo --------------------------------------------------------------------------

REM ----------------------------------------------------------------------------
REM References
REM ----------------------------------------------------------------------------
REM Windows file associations
REM http://vim.wikia.com/wiki/Windows_file_associations
REM
REM Managing Files from the Command Line - Assoc and Ftype
REM http://commandwindows.com/assoc.htm
REM
REM Adding Associations
REM http://winbeginners.com/articles/associations3.htm
REM
REM CClean scan result show some error about registry HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts
REM
REM http://superuser.com/questions/212848/how-change-file-association
REM
REM Windows registry information for advanced users
REM http://support.microsoft.com/kb/256986
REM ----------------------------------------------------------------------------

REM setlocal enabledelayedexpansion 
set PROGRAM_DIR=%%ProgramFiles%%
if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" set PROGRAM_DIR=%%ProgramFiles(x86)%%

REM notepad2
set NOTEPAD2=%%SystemRoot%%\notepad2.exe

REM Notepad++
set NPP=%PROGRAM_DIR%\Notepad++\notepad++.exe
if not exist "%ProgramFiles%\Notepad++\notepad++.exe" set NPP=%NOTEPAD2%

REM EditPlus
set EDITPLUS=%PROGRAM_DIR%\EditPlus 3\editplus.exe
if not exist "%ProgramFiles%\EditPlus 3\editplus.exe" set EDITPLUS=%NPP%

REM ----------------------------------------------------------------------------
REM Text file
REM ----------------------------------------------------------------------------
assoc .csv=txtfile
REM CueSheet
assoc .cue=txtfile

REM ----------------------------------------------------------------------------
REM C/C++
REM ----------------------------------------------------------------------------
assoc .h=SourceCode.C
assoc .c=SourceCode.C
assoc .hpp=SourceCode.C
assoc .cpp=SourceCode.C
assoc .cxx=SourceCode.C
assoc .rc=SourceCode.C
assoc .inc=SourceCode.C
REM AMXModX Script
assoc .sma=SourceCode.C


REM ----------------------------------------------------------------------------
REM Java
REM ----------------------------------------------------------------------------
assoc .java=SourceCode.Java
REM BeanShell
assoc .bsh=SourceCode.Java
REM ZK Script
assoc .zs=SourceCode.Java

REM ----------------------------------------------------------------------------
REM C#
REM ----------------------------------------------------------------------------
assoc .cs=SourceCode.CSharp

REM ----------------------------------------------------------------------------
REM SQL
REM ----------------------------------------------------------------------------
assoc .sql=sqlfile

REM ----------------------------------------------------------------------------
REM Web
REM ----------------------------------------------------------------------------
REM assoc .css=CSSfile
REM assoc .html=htmlfile
REM assoc .htm=htmlfile
assoc .shtml=htmlfile
REM assoc .js=jsfile

assoc .htc=htcfile

assoc .zul=SourceCode.ZK.UI
assoc .zhtml=SourceCode.ZK.UI
assoc .jsp=SourceCode.JSP
assoc .jspx=SourceCode.JSP

assoc .php=SourceCode.PHP

assoc .asp=SourceCode.ASP
assoc .aspx=SourceCode.ASP


REM ----------------------------------------------------------------------------
REM Shell
REM ----------------------------------------------------------------------------
assoc .awk=SourceCode.Shell
assoc .sed=SourceCode.Shell
assoc .sh=SourceCode.Shell
assoc .ps=SourceCode.PowerShell

REM assoc .bat=batfile
REM assoc .cmd=cmdfile
REM 对于批处理文件,不修改默认关联,而仅仅修改“编辑”动作的关联

REM ----------------------------------------------------------------------------
REM Configuration
REM ----------------------------------------------------------------------------
REM assoc .ini=inifile
REM assoc .inf=inffile
assoc .cfg=cfgfile
assoc .conf=Configuration.POSIX
assoc .properties=Configuration.Java

assoc .svg=svgfile
REM reg add


REM ----------------------------------------------------------------------------
REM Misc
REM ----------------------------------------------------------------------------
REM assoc .dsn=ODBC.FileDSN
REM assoc .eml=Microsoft Internet Mail Message
REM assoc .hta=htafile
REM assoc .jnlp=JNLPFile
REM assoc .log=txtfile
assoc .m3u=m3ufile
REM assoc .mht=mhtmlfile
REM assoc .mhtml=mhtmlfile
REM assoc .nfo=MSInfo.Document
REM assoc .reg=regfile
REM assoc .rtf=rtffile
REM assoc .scp=txtfile
REM SELinux Targeted policy .te
assoc .te=txtfile
REM assoc .txt=txtfile
REM assoc .wsc=scriptletfile
REM assoc .WSF=WSFFile
REM assoc .WSH=WSHFile
REM assoc .wtx=txtfile
REM assoc .xaml=Windows.XamlDocument
REM assoc .xhtml=xhtmlfile
REM assoc .xml=xmlfile


call :np2_open txtfile inifile jsfile cfgfile Configuration.POSIX Configuration.Java
call :np2_edit batfile cmdfile jsfile WSFFile WSHFile regfile m3ufile ODBC.FileDSN "Microsoft Internet Mail Message"

call :ep_open cssfile xmlfile xslfile xsltfile SourceCode.C SourceCode.Java SourceCode.CSharp SourceCode.JSP SourceCode.PHP SourceCode.ASP SourceCode.ZK.UI
call :ep_edit xmlfile svgfile htmlfile xhtmlfile shtmlfile htafile htcfile rtffile JNLPFile

call :npp_open SourceCode.Shell SourceCode.PowerShell sqlfile

pause


goto :EOF

:np2_open
if "%~1"=="" goto :EOF
REM echo %NOTEPAD2%  [Open]  %1
ftype %1="%NOTEPAD2%" "%%1"
shift
goto np2_open

:np2_edit
if "%~1"=="" goto :EOF
echo %NOTEPAD2%  [Edit]  %1
reg add "HKLM\Software\Classes\%~1\shell\edit\command" /ve /t REG_EXPAND_SZ /f /d "\"%NOTEPAD2%\" \"%%1\""
shift
goto np2_edit


:npp_open
if "%~1"=="" goto :EOF
REM echo %NPP%  [Open]  %1
ftype %1="%NPP%" "%%1"
shift
goto npp_open

:npp_edit
if "%1"=="" goto :EOF
echo %NPP%  [Edit]  %1
reg add "HKLM\Software\Classes\%~1\shell\edit\command" /ve /t REG_EXPAND_SZ /f /d "\"%NPP%\" \"%%1\""
shift
goto npp_edit


:ep_open
if "%~1"=="" goto :EOF
REM echo %EDITPLUS%  [Open]  %1
ftype %1="%EDITPLUS%" "%%1"
shift
goto ep_open

:ep_edit
if "%~1"=="" goto :EOF
echo %EDITPLUS%  [Edit]  %1
reg add "HKLM\Software\Classes\%~1\shell\edit\command" /ve /t REG_EXPAND_SZ /f /d "\"%EDITPLUS%\" \"%%1\""
shift
goto ep_edit

Liu、これは私が思っていたよりもさらに良いです。一度設定すると、永久に適用されます。今はかなり遅れています(午前4時)が、朝一番にこれを試しています!
ルーク

0

[ファイルの種類]リストからファイルの関連付けを変更または作成するには

場合で開くコマンドが使用できない場合は、次の手順を試してください:
クリックしてスタートし、[OK]をクリックしますコントロールパネルを
[ フォルダオプション]をクリックします。
[ フォルダオプション ] ウィンドウの[ ファイルタイプ ]タブをクリックすると、完全なファイルタイプとその関連付けが一覧表示されます。 [ 新規 ]をクリックし、ボックスにファイル拡張子を入力して、[ 詳細設定 ]をクリックします。 ファイルタイプの関連付けを選択します。 [ OK ]をクリックし、[ 閉じる ]をクリックします。 ファイルを再度開きます。





30の拡張機能を頻繁に変更しようとしている場合、それはむしろ遅くないでしょうか?
ルーク

さて、それは他の方法よりも高速です
...-imtheman

OK、
ルーク

0

役に立つかもしれないいくつかのプログラム:

他に興味のあるもの(特にポータブルアプリについて言及したため)はCoffeeで、ポータブルアプリを使用して指定されたすべてのファイルタイプを一時的に開くために使用できます。たとえば、USBスティックにポータブルテキストエディターがある場合、Coffee(同じスティックに常駐)を構成して、.txt拡張子をエディターに関連付けることができます。そうすれば、Coffeeが実行されている限り、.txtファイルはポータブルエディターで自動的に開きます。コーヒーを閉じると、出来上がり、.txtの関連付けは以前の状態にリセットされます!

弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.