Answers:
在命令窗口中,可以使用“ ASSOC”和“ FTYPE”命令来添加/编辑/删除文件类型关联。
C:>assoc /?
ASSOC [.ext[=[fileType]]]
.ext Specifies the file extension to associate the file type with
fileType Specifies the file type to associate with the file extension
Type ASSOC without parameters to display the current file associations.
If ASSOC is invoked with just a file extension, it displays the current
file association for that file extension. Specify nothing for the file
type and the command will delete the association for the file extension.
和:
C:>ftype /?
FTYPE [fileType[=[openCommandString]]]
fileType Specifies the file type to examine or change
openCommandString Specifies the open command to use when launching
files of this type.
Type FTYPE without parameters to display the current file types that
have open command strings defined. FTYPE is invoked with just a file
type, it displays the current open command string for that file type.
Specify nothing for the open command string and the FTYPE command will
delete the open command string for the file type. Within an open
command string %0 or %1 are substituted with the file name being
launched through the assocation. %* gets all the parameters and %2
gets the 1st parameter, %3 the second, etc. %~n gets all the remaining
parameters starting with the nth parameter, where n may be between 2 and 9,
inclusive.
... ...
因此(在我的系统上)关于.bkr文件,这些命令将返回:
C:>assoc .bkr
.bkr=bkrfile
C:>ftype bkrfile
bkrfile="F:\Program Files\path...\program.exe" "%1"
我创建了一个新的“测试”文件扩展名/文件类型(可能需要管理员权限):
C:>assoc .bzb
File association not found for extension .bzb
C:>assoc .bzb=MyBZBCustomFileType
.bzb=MyBZBCustomFileType
C:>assoc .bzb
.bzb=MyBZBCustomFileType
C:>ftype MyBZBCustomFileType
File type 'MyBZBCustomFileType' not found or no open command associated with it.
C:>ftype MyBZBCustomFileType=%SystemRoot%\system32\NOTEPAD.EXE %1
MyBZBCustomFileType=C:\Windows\system32\NOTEPAD.EXE %1
C:>echo Some text.>C:\Temp\file.bzb
C:>start "" C:\Temp\file.bzb
这将打开“记事本”,编辑我的“虚拟”文件。
要删除文件类型关联,请首先删除文件类型与程序的连接,如下所示:
C:>ftype MyBZBCustomFileType
MyBZBCustomFileType=C:\Windows\system32\NOTEPAD.EXE %1
C:>ftype MyBZBCustomFileType=
File type 'MyBZBCustomFileType' not found or no open command associated with it.
然后删除文件扩展名关联(可能需要管理员权限):
C:>assoc .bzb
.bzb=MyBZBCustomFileType
C:>assoc .bzb=
C:>assoc .bzb
File association not found for extension .bzb
C:>start "" C:\Temp\file.bzb
(The dialogbox "Windows cannot open this file" opens)
C:>
对于GUI解决方案,我使用Creative Elements的PowerTools。您可以免费试用45天,免费下载和使用。这是一组工具,您将使用它们的File Type Doctor
工具来添加/编辑/删除文件类型关联。
assoc .bzb=
和ftype MyBZBCustomFileType=
官方的方式来删除文件关联或有做另一种适当的方式?ftype /?
而且assoc /?
似乎没有提及使用=
删除文件关联是合法的。
assoc /?
和捕获的ftype /?
。对于assoc /?
:Specify nothing for the file type and the command will delete the association for the file extension.
,并为ftype /?
:Specify nothing for the open command string and the FTYPE command will delete the open command string for the file type.
右键单击.cfg文件->打开方式->选择默认程序。然后选中“始终使用选定的程序来打开这种文件”,然后从列表中选择一个程序,或单击“浏览”按钮从文件系统中手动选择一个程序。
带有图像的完整指南:http : //www.sevenforums.com/tutorials/12196-open-change-default-program.html