📎 AI Summary:
The thread discusses how to associate file extensions with a program that runs from a USB or network drive and is not listed in Windows 7’s default program settings. The original poster seeks a way to set default file associations without installing the program formally. Respondent BurrWalnut explains that this can be done manually using the ‘assoc’ and ‘ftype’ commands in the command prompt, providing examples and guidance on modifying registry entries for such associations.

pstein

Extraordinary Member
Member details
Joined
Mar 20, 2010
Messages
454
Thread Author #1
Assume I run a program from USB flash drive or network drive.
It is not installed on the local Win 7 computer but it works.

Hence when I go to menu

START--->Control Panel--->Programs--->Default programs

this program is NOT listed there as a possible application.
So it cannot be defined as a default program for selected file associations.

How can I associate some file extensions to such a program anyway?

I guess I have to declare this program as a valid target for file associations. How does that work (without full (re)installation)?
 

Solution
To do it manually, you would use the assoc command to associate extensions to file types and the ftype command to associate a file type with an application. For example, if you had an extension named .ldg that was used by a program named ledger.exe, you would create a file type called, say, myaccs. To run the commands open a Run window (Windows Logo key+R), type cmd and press Enter. The manual assoc and ftype commands would be:

assoc .ldg=myaccs (make sure you use a unique name for filetype, otherwise chaos will prevail, check the registry if in doubt)
assoc .acc=myaccs (i.e. more than one extension can be associated to a file type)
ftype myaccs= %SystemRoot%\Program Files\ledger.exe %1(this is the location of the program)

Now, when...

BurrWalnut

Essential Member
Member details
Joined
Nov 14, 2008
Messages
110
To do it manually, you would use the assoc command to associate extensions to file types and the ftype command to associate a file type with an application. For example, if you had an extension named .ldg that was used by a program named ledger.exe, you would create a file type called, say, myaccs. To run the commands open a Run window (Windows Logo key+R), type cmd and press Enter. The manual assoc and ftype commands would be:

assoc .ldg=myaccs (make sure you use a unique name for filetype, otherwise chaos will prevail, check the registry if in doubt)
assoc .acc=myaccs (i.e. more than one extension can be associated to a file type)
ftype myaccs= %SystemRoot%\Program Files\ledger.exe %1(this is the location of the program)

Now, when you double-click on a file with the extension .ldg or .acc, Windows will recognize it and launch ledger.exe.

An easier to understand example of the above is a .txt file, which we all use in Notepad:
Typing assoc .txt will return txtfile (the file type)
Typing ftype txtfile will return %SystemRoot%\System32\notepad.exe %1 (the full path of the program and %1 representing a passed parameter)
Alternatively, look in the registry hive HKEY_CLASSES_ROOT for .txt and further down for txtfile.
 

Last edited:
Solution