/build/static/layout/Breadcrumb_cap_w.png

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.

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.
Posted by: anonymous_9363 12 years ago
Red Belt
1
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.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ