Just to extend Gareth's answer:
From playing with the registry it looks like
- entries from
HKEY_CURRENT_USER\Software\Classes
override entries fromHKEY_LOCAL_MACHINE\Software\Classes
in theHKEY_CLASSES_ROOT\Software\Classes
- setting file's extention association from command line using
assoc
command acts uponHKEY_LOCAL_MACHINE\Software\Classes
- setting file type association from command line using
ftype
command acts uponHKEY_LOCAL_MACHINE\Software\Classes
- using
REG_EXPAND_SZ
type of registry key for extension or file type and environment variable in the key's value allows to set the default program per command line session