Add a new file association in Windows 7 [closed] - windows-7

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
With Windows XP I could use the Control Panel to add a new file extension, associate it with a program, and assign an icon to it. I did that using Folder Options in the Control Panel. Folder Options has a tab in it called "File Types".
But Windows 7 Folder Options does not have that tab. And the suggested place for file associations (Default Programs) does not let me add a new extension.
How do I do what I want to (i.e. associate a new extension with an existing program and also apply a new icon to it)?

Unfortunately it's one of those things they made more complicated in an attempt to make it more simple (e.g. you're able to change the associated program, but that's it).
You can either use third party programs or just edit the registry yourself (do not modify the registry unless you're really sure on what you're doing! Mistakes might break settings or even make your system unbootable!):
Right click HKEY_CLASSES_ROOT and pick New, Key. Name it according to your desired file extension, e.g. .ext. If it exists already, you can skip this step.
Set the default value of the key you just created to some unique name that isn't used yet, e.g. MyFileType. Again, if it's set already, skip this step.
Create another new key using the same name you picked in the previous step. Skip this too, if the key exists already.
Set the default value of the new key to the name that should appear in Windows Explorer and other programs as the file type.
Right click the new key and create a subkey DefaultIcon.
Set the new key's default value to C:\Some\Path\To\Your\Icon\Ressource.ico,0 (the 0 is the index of the icon to be used; if there's only one icon in the ressource, it has to be 0).
Create another new key next to DefaultIcon and call it shell.
Now, for each verb/action you'd like to associate, create a new sub key with the desired name. Some verbs are preset and will automatically use localized names, e.g. open, edit or print.
For each verb create a sub key command and set its default value to the program to be run. Also make sure to include all parameters needed, adding quotes if there are spaces inside, e.g. "C:\My Path\My Program.exe" "%1". %1 will be replaced with the actual file name picked for this action.

If "Open With" isn't offered, just click on "Open". If there is no default program already associated with the file type, you'll be given a choice of searching for a suitable program on the Web, or selecting a program from a list of installed programs, just as with the old "Open With".

In Windows 7, you can also right click and go Properties -> General Tab and there is "Open with" and [Change] button. This way you can also set association for a new file type.

For Windows, you can always right click and select 'Open With'. Choose the option that says select a program from a list. You can then select your own program and tell it to open files of such extension with that program by default. To change the icons, this link can help you (Change Windows icon)

To avoid editing the registry, instead create a new file with the desired extension. When you double-click it you will get the Can't Open dialog and you can select a program from a list of installed programs. Browse to select your desired application, add the description and check the always use the selected program. Now the extension is in the default programs list and can be further edited and changed as you are used to.

If 'open with' is available after right clicking, it's pretty straight forward. If not...
Type 'default programs' into start menu, then select 'set associations'.
I don't know why MS decides to sometimes take away the 'open with' option...

Probably to streamline the experience and make it easier to understand (although I don't know why they didn't keep it behind some "advanced" button for power users).
Because that's Microsoft's entire MO in general...presume that every single person that uses their software is incapable of making technical decisions. It would be so simple for them to include one little link in that Default Programs window saying "add an extension", and for that to be linked to another window where you can easily do this within a safe, GUI environment. Instead they force us to edit the registry, which is 10 times more dangerous! And if they're worried about average Joe's wrecking their computers, they could include a simple message box that informs the user of the risk!
Honestly MS, I've been an amateur developer for no more than 10 years, and the biggest software giant in the world can't employ programmers with more, or even an equal level of, knowledge as me?!?! So how did you get to that status in the first place?!?! It really boggles my mind!
Sorry for not actually adding anything constructive to the discussion but this whole perception by MS of its customers as being non-trustworthy little children really cheeses me off...and I came here in search of an answer to the same question that the OP asked, but I guess there is none (other than messing around with the registry, which I really hate doing).

Related

Win CLI open file with "How to open"?

I need to open the file using Windows 10 cmd. But when the file opens, I need Windows to show me a modal window "How do you want to open this file?". The system should do this even if it already has a program selected by default to open a certain type of file. Is it possible to do this?
To clarify my problem:
I need the console to run for example ".py" not through the standard Python.File="C:\Windows\py.exe " "%L" %*, and for example via VS Code. You might tell me about the VS Code CLI. But how to handle an event where the user will not have VS Code, but for example Pycharm, and the user will want to open it through it? That is why the question was posed in such a way that the user could choose through what to open the file already through the built-in modal window in Windows. In any case, I will be glad of any suggestion to solve my problem.
I tried to find something similar, but apart from the standard start something.som I didn't find it. And this is not a solution to the problem, because start starts the file in the program that is specified by default in the system. This program may not even be the one that the user ever chose later. I came across a similar question in Stackoverflow, where a person wanted to see which program was responsible for opening a file with a certain extension, where assoc and ftype were used, but they did not give the desired result.

Add menu item to windows context menu only for text selection

Someone know where can I add registry key for add some function to the right-click menu only when some text is selected?
Such as copy,paste,cut function
Thanks :)
As per the last comment by #zionpi and the specification by #Math1000 stating "Specifically looking to convert LaTex to plain text", I am assuming that the OP is looking to add an option in the context menu for all strings(or text) displayed(or presented) by all and any applications running in the system, which allows the user to, as per the original question, open that particular selected string in explorer if it is a valid path in the system or, as per the added specification, convert that particular selected string to plain text if it is a valid LaTex code (by copying the converted LaTex code to clipboard, perhaps?).
While the validation of the selected text (to check whether it is a valid directory or LaTex code) and implementation of the operation succeeding the validation can be feasibly implemented without any difficulty, the context menu option requiring to be available for "ALL" texts displayed by "ALL" applications in the system is impossible to implement. This is because there is no way to alter the context menus of individual 3rd party applications as their context menus are regulated and controlled by the application itself by the nature of their source code during development and would require APIs released by the concerned application developers themselves to facilitate this demand.
One infamous application that allows the implementation of such behaviors is Office, for which you can build add-ons to customize certain aspects of the application (whose tutorials can be found here and here (for .NET interoperability)) to implement said requirements.
While irrelevant to the original requirement, it is worth looking into the shortcut menu handlers of the shell extension development process here as it is a better and a much more elegant way of adding/implementing right-click context menus in comparison to the way mentioned in the OP's question i.e. by editing the registry.

Find the relation between ".automaticDestinations-ms" and it's file?

Does anyone know (Because on microsoft forums nobody answered me), how can I find what app has which automaticDestinations-ms file in %appdata%\microsoft\windows\recent\automaticdestinations ?
That's the folder where Windows 7 stores its jump lists, and I want to know how to automatically/programmatic find the relation between each file and an application.
At least, even manual I didn't found any pattern, just to look after file extensions in the files, because some programs open files with the same extension (like images), so this method it's not OK for all programs.
Do you have any other idea? Maybe knowing the format of those files?
Thanks.
the GUIDs appear to persist.
I was trying to edit my control panel jumplist - I found where the "Realtek HD audio manager" control-panel-applet-title-string is (using resource hacker on "C:\Windows\System32\RTSnMg64.cpl"), and restored it's original title ("Dell Audio" - 'cause I'm OCD:) but the original pinned Realtek entry is stuck.
A quick filesearch for pinned took me to
C:\Users\Jonny\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned
but I really needed to be # C:\Users\Jonny\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations
If you use something like Nirsoft's Jumplist View you can see the entries etc. Sort by "application ID" column to see jumplists by application. You can even change the monitored folder (advanced options).
I'm going to have to delete and recreate my control panel jumplist (7e4dca80246863e3.automaticDestinations-ms).
TIP: If you're not sure which is which, try pinning a new jumplist-entry to an application. This will appear at the top (if sorted by "record time")
The best way to find out is to sort the files by date modified, then interact with your machine, eg open a file with Powerpoint, look and see what file moved to the top. That is probably the file for Powerpoint, which you can confirm by opening it and looking in it.
Then you could build a table of magic guids, and search for those in the registry to see if there is an obvious key connecting the guid to an application id.
Here is a list of 620 applications here with the corresponding App ID byEricZimmerman
https://github.com/EricZimmerman/JumpList/blob/master/JumpList/Resources/AppIDs.txt
eg 0a1d19afe5a80f80|FileZilla 2.2.32
last update 12 days ago

Where does Windows store its "Open With" settings?

I'm trying to programmatically check file associations by the file extension (for example .jnlp files). I keep reading that
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\JNLPFile\Shell\Open\Command
is the Registry key to check. However, if you change the association through Windows Explorer:
Open With > Choose Program > (Always use the selected program)
the change isn't at all reflected in this Registry key. Where else is this information stored?
Take a look in:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\
and the sub-key of that is the extension you reassigned. Under that there will be the UserChoice and OpenWithList sub-keys which will contain your redefinition.
You may also want to read http://support.microsoft.com/kb/950505 which talks about your issue.
Update
As of Windows 8, life has gotten far more complicated. To create an extension association a custom hash needs to get calculated.
Fortunately, someone has reverse engineered the process and created a PowerShell script to do this without having to go through any GUI.
You can find it at the following GitHub link:
https://github.com/DanysysTeam/PS-SFTA
This is a two-part look-up.
First, you look up the default value of HKEY_CLASSES_ROOT\[file_extension]. For your extensions, .jnlp, the value is "JNLPFile". Let's call this the [file_descriptor].
Now you can look up the default value of HKEY_CLASSES_ROOT\[file_descriptor]\Shell\[action]\command (where [action] is the shell action you are interested in, e.g.: Open, Print, Edit, etc.).
On:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jnlp\OpenWithList
Tip: Edit>Find is pretty handy at these situations. :)

Install Shield 2009 - Shortcuts creation

Is it possible to create shortcuts in Install Shield 2009 based on user input?
In essnes, a shortcut will be created (on the desktop) only if the user (who runs the installation) wants to do so
We have a screen that prompts the user to create desktop and quicklaunch shortcuts.
The shortcuts are then each in individual components with a condition set to only install if the checkbox was selected.
You also should store this response in the registry somewhere, and read it back during a reconfigure, upgrade, repair, etc. Otherwise if the checkboxes were on by default and that screen does not display to the user, the condition will evaluate to true (because the default property is true) and although the shortcut was not initially installed, it will be created during the repair if the components condition is reevaluated.
I do something similar to Sacha, but I'm lazier. ;-)
I create a component for each desktop shortcut (I hate software that assumes it's allowed to dump shortcuts on my desktop); no file in the component. Then I assign each of these components to its own feature. Then I can use standard feature selection dialogs (which is built in automatically and used when the user selects a Custom installation) to let the user select the desktop shortcut features.
I don't see a lot of software installers offering to install optional shortcuts in the feature selection dialog, but it strikes me as a natural place to do it. More technical users may see this as mixing metaphors.
FWIW, I originally did this in an InstallScript/MSI project, and I've just done the exact same thing in a straight MSI project, and the technique works fine in both.
It's been a while since I've used installshield, my company is currently using WISE as an installer; however, it should be possible to do what you are asking.
In general installer terms you need to do the following:
Make a screen for your installer that presents the option to create the shortcut, this screen should have the prompt text and a checkbox.
There should be a mechanism for storing the response of the checkbox in an Installshield property.
During the execution phase, use the reponse to trigger the creation of the shortcut.
I don't know about the capabilities of Installshield 2009 for whether this can be done without editing the script itself.
I hope this helps.

Resources