choco icon indicating copy to clipboard operation
choco copied to clipboard

File associations: works partially on Windows 7 and Windows 10

Open erotavlasme opened this issue 9 years ago • 10 comments

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"

erotavlasme avatar Feb 11 '16 12:02 erotavlasme

@mwrock can you have a look at this one?

ferventcoder avatar Feb 11 '16 14:02 ferventcoder

Do you need log or debug? I can reproduce them.

erotavlasme avatar Feb 11 '16 14:02 erotavlasme

Run your command with -d -v. Thanks!

ferventcoder avatar Feb 11 '16 15:02 ferventcoder

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.

erotavlasme avatar Feb 11 '16 18:02 erotavlasme

@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.

gep13 avatar Feb 11 '16 18:02 gep13

This is the git file link https://gist.githubusercontent.com/erotavlas85/a92ac6974212882ecf17/raw/c7b71db8ac1bccfbb10f20b11410856cb338cf9a/log.sh

erotavlasme avatar Feb 11 '16 19:02 erotavlasme

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

AeliusSaionji avatar Feb 12 '16 19:02 AeliusSaionji

Any news?

erotavlasme avatar Mar 27 '16 21:03 erotavlasme

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.

image

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.

pauby avatar Apr 12 '24 19:04 pauby

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.

github-actions[bot] avatar May 13 '24 04:05 github-actions[bot]

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.

github-actions[bot] avatar May 27 '24 04:05 github-actions[bot]