Add to Technorati Favorites Add to Google

List file extensions registered in the system

Q: Is there a simple way to list all the defined file types on a PC and have the output redirected to a text file? I’m using Windows XP with Service Pack 2.

Yes. There are two options that I think of (without using a third-party tool). If you’re using Windows XP Professional, you can use the ASSOC command to get the list of file types registered in the system, along with the ProgIDs. Click Start, Run and type:

cmd /c assoc >"%userprofile%\desktop\filetypes.txt"

Open filetypes.txt (present in your Desktop) using Notepad to view the contents. The output will look like this:

.323=h323file
.386=vxdfile
.3g2=Nokia.Multimedia
.3gp=Nokia.Multimedia
.a=
.aac=AudioManager.File
.aca=Agent.Character.2
.accdt=
.acf=Agent.Character.2
.acl=ACLFile
.acs=Agent.Character2.2
.act=actfile

USING A WMI SCRIPT

Here is a little WMI script that I wrote enumerates the HKEY_CLASSES_ROOT hive and stores the list of registered file extensions to a text file named FileTypesList.txt on the Desktop.

Option Explicit
Dim fso, b, objReg, strComputer, WshShell
Dim arrSubKeys, strKeyPath, subkey, strLogFile
Const HKEY_CLASSES_ROOT = &H80000000

Set WshShell = CreateObject("Wscript.Shell")
strLogFile= WshShell.SpecialFolders("Desktop") & _
"\FileTypesList.txt"
Set fso = Wscript.CreateObject("Scripting.FilesystemObject")
set b = fso.CreateTextFile (strLogFile,true)

b.Writeline "File types registered in the system"
b.writeblanklines 1

strComputer = "."

Set objReg = GetObject _
("winmgmts:{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\default:StdRegProv")

strKeyPath = ""
objReg.EnumKey HKEY_CLASSES_ROOT, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
If Left(subkey,1) = "." Then
     b.writeline subkey
End If
Next

b.writeblanklines 2
b.Writeline "(Generated on " & Now() & ")"
b.close
WshShell.Run "notepad " & strLogFile, 1,True

Set fso = Nothing
set WshShell = Nothing

RUNNING THE SCRIPT

Copy the above code to Notepad and save the file as "filetypeslist.vbs". Then double-click the file to run it.

SAMPLE OUTPUT

.323
.386
.3g2
.3gp
.a
.aac
.aca

RELATED POSTS


BOOKMARK THIS PAGE

BlinkList | del.icio.us | Digg it | Furl | ma.gnolia | Newsvine | reddit | Spurl | Wink |


If you enjoyed this post, make sure you subscribe to our RSS feed! We feature Tips, Troubleshooting information, Scripts and Utilities for Microsoft Windows Operating Systems!
Prefer an E-mail subscription?

Enter your email address:

Delivered by FeedBurner

Post a Response