Command Line to Associate Files with Windows 7
Ok, I'm at my wits end trying to figure this out. I've googled this problem for 2 days and couldn't find anything that worked.
Anyone have a command line or script that will associate programs to a file type? I've tried the assoc command line and another hkcu script that didn't work.
Any help would be greatly appreciated.
Anyone have a command line or script that will associate programs to a file type? I've tried the assoc command line and another hkcu script that didn't work.
Any help would be greatly appreciated.
0 Comments
[ + ] Show comments
Answers (1)
Answer Summary:
Start at [TargetHive]\Software\Classes, where you make an entry of '.[ext]' with a 'Default' value of some name, e.g. MyNewExt. Now you need another entry, at the same level, with the same name, in this case 'MyNewExt'. [TargetHive] is HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE, depending on whether you want a user-specific or machine-wide definition. Next, you need a tree structure HKEY_CURRENT_USER\Software\Classes\MyNewExt\shell\open\command, whose 'Default' value points to the executable which will load the .ext file, together with the parameter '%1'. You can do this in batch (using REG.EXE) but I would imagine most people would use VBS or, nowadays,PowerShell. There are LOADS of sample registry scripts available.
Start at [TargetHive]\Software\Classes, where you make an entry of '.[ext]' with a 'Default' value of some name, e.g. MyNewExt. Now you need another entry, at the same level, with the same name, in this case 'MyNewExt'. [TargetHive] is HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE, depending on whether you want a user-specific or machine-wide definition. Next, you need a tree structure HKEY_CURRENT_USER\Software\Classes\MyNewExt\shell\open\command, whose 'Default' value points to the executable which will load the .ext file, together with the parameter '%1'. You can do this in batch (using REG.EXE) but I would imagine most people would use VBS or, nowadays,PowerShell. There are LOADS of sample registry scripts available.
Please log in to answer
Posted by:
anonymous_9363
12 years ago
File associations are set in the registry.
Start at [TargetHive]\Software\Classes, where you make an entry of '.[ext]' with a 'Default' value of some name, e.g. MyNewExt. Now you need another entry, at the same level, with the same name, in this case 'MyNewExt'. [TargetHive] is HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE, depending on whether you want a user-specific or machine-wide definition.
Next, you need a tree structure HKEY_CURRENT_USER\Software\Classes\MyNewExt\shell\open\command, whose 'Default' value points to the executable which will load the .ext file, together with the parameter '%1'.
You can do this in batch (using REG.EXE) but I would imagine most people would use VBS or, nowadays,PowerShell. There are LOADS of sample registry scripts available.
Start at [TargetHive]\Software\Classes, where you make an entry of '.[ext]' with a 'Default' value of some name, e.g. MyNewExt. Now you need another entry, at the same level, with the same name, in this case 'MyNewExt'. [TargetHive] is HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE, depending on whether you want a user-specific or machine-wide definition.
Next, you need a tree structure HKEY_CURRENT_USER\Software\Classes\MyNewExt\shell\open\command, whose 'Default' value points to the executable which will load the .ext file, together with the parameter '%1'.
You can do this in batch (using REG.EXE) but I would imagine most people would use VBS or, nowadays,PowerShell. There are LOADS of sample registry scripts available.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.