File associations: works partially on Windows 7 and Windows 10
Hi,
I would report the following behaviour. On Windows 7 and 10 some files association does not work.
The following works with windows 7 but does not work on windows 10
Install-ChocolateyFileAssociation ".html" "$ProgramsPath\Mozilla Firefox\firefox.exe"
The following works only on windows 7 and only for .ps1 file extension
Install-ChocolateyFileAssociation ".txt" "${env:ProgramFiles(x86)}\Notepad++\notepad++.exe"
Install-ChocolateyFileAssociation ".ps1" "${env:ProgramFiles(x86)}\Notepad++\notepad++.exe"
The following works for both windows 7 and windows 10
Install-ChocolateyFileAssociation ".rar" "$ProgramsPath\7-Zip\7zFM.exe"
Install-ChocolateyFileAssociation ".zip" "$ProgramsPath\7-Zip\7zFM.exe"
Install-ChocolateyFileAssociation ".7z" "$ProgramsPath\7-Zip\7zFM.exe"
@mwrock can you have a look at this one?
Do you need log or debug? I can reproduce them.
Run your command with -d -v. Thanks!
Sorry, where have I to add these options? If I add these options here Install-ChocolateyFileAssociation I cannot see any debug output in chocolatey.log.
@erotavlas85 When you are installing the package that you are creating, that is using Install-ChocolateyFileAssociation, add the options to the install command, similar to this:
choco install <packagename> -dv
this simply turns on debug and verbose logging, so that there will be much more output, which might help in figuring out what the issue it. The output will be at the command line.
This is the git file link https://gist.githubusercontent.com/erotavlas85/a92ac6974212882ecf17/raw/c7b71db8ac1bccfbb10f20b11410856cb338cf9a/log.sh
Maybe you are already aware of this, but in case you aren't:
I believe 10 no longer allows you to programatically set the default association (possibly only applies to a few common extensions like txt, html, http:// protocol, etc). Instead, there seems to be a subtle distinction: you can register a program as supporting an extension, and then the user must choose to open with that program. Windows 10 will ask you how you wish to open file.extension-you-just-opened if there are newly registered associations.
These batch files might be informative https://github.com/rossy/mpv-install
Any news?
I created a package with the following code in chocolateyInstall.ps1:
$ErrorActionPreference = 'Stop' # stop on all errors
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
Install-ChocolateyFileAssociation ".txt" "${env:ProgramFiles}\Notepad++\notepad++.exe"
Install-ChocolateyFileAssociation ".ps1" "${env:ProgramFiles}\Notepad++\notepad++.exe"
Which installed fine.
When I create a .txt and .ps1 file and double-click it, it opens Notepad++ as expected.
So I can't reproduce the issue here and don't think there is anything we need to do.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue will be closed in 14 days if it continues to be inactive.
Dear contributor,
As this issue seems to have been inactive for quite some time now, it has been automatically closed. If you feel this is a valid issue, please feel free to re-open the issue if / when a pull request has been added. Thank you for your contribution.