在Windows 7中删除文件类型关联


Answers:


13

在命令窗口中,可以使用“ 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工具来添加/编辑/删除文件类型关联。


2
这似乎不适用于用户通过GUI创建的关联。
2013年

@depquid-尝试时会收到错误消息,还是只是默默地失败了?请记住,您可能需要以管理员身份打开命令提示符(assoc / ftype)才能工作。另外,我在我使用的GUI(文件类型编辑器)上添加了信息,它应该适合您。
凯文·费根

@KevinFegan,是assoc .bzb= ftype MyBZBCustomFileType= 官方的方式来删除文件关联或有做另一种适当的方式?ftype /?而且assoc /?似乎没有提及使用=删除文件关联是合法的。
Pacerier,2015年

@Pacerier-如果您查看我的答案(以上),则前两个“代码”部分是从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.
凯文·费根

@ KevinFegan,IC。
Pacerier,2015年

5

您可以在注册表中删除关联:

HKEY_CLASSES_ROOT\.cfg\ShellEx\

并使用与写字板相对应的GUID删除密钥。


1
如果那是您想要的,那将完全删除它。如果只想更改它,请右键单击并选择“打开方式”。然后选择新程序并选中“始终使用此程序来打开此类型的文件”。
LilCodger

2
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.cfg
史蒂夫·投手

4

您可以使用这个很棒的第三方应用程序,默认程序编辑器

通过“默认程序编辑器”,可以轻松修复Windows中的文件关联设置,包括上下文菜单项,图标和说明。另外:自动播放设置和默认程序设置...全部,无需摆弄注册表。

在此处输入图片说明


2

使用内置的Windows 7工具(用户界面工具)更改关联的方法(似乎并不能让您删除)是打开“ 开始”菜单,然后选择“ 默认程序”。(或者,如果不存在,请打开“ 开始”菜单,“ 控制面板”(您可能需要从“按类别查看”更改为“按大图标查看”),然后打开“ 默认程序”。)

然后选择将文件类型或协议与程序相关联。您将获得一个列表,其中包含计算机中当前配置的关联。找到您要更改的扩展名,然后双击以更改其配置。


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.