microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.67k stars 6.57k forks source link

HostsFile-Editor uses outdated notepad-version #33240

Open rka-ppi opened 5 months ago

rka-ppi commented 5 months ago

Microsoft PowerToys version

0.81.1

Installation method

PowerToys auto-update

Running as admin

Yes

Area(s) with issue?

Hosts File Editor

Steps to reproduce

  1. Running PowerToys in AdminMode
  2. Open HostsFile-Editor
  3. Select Open Hosts File to open it in notepad
  4. An old outdated notepad-version appears

image

✔️ Expected Behavior

Should use the actual notepad verson

❌ Actual Behavior

An old outdated notepad-version appears

Other Software

Edition Windows 11 Enterprise Version 23H2 Betriebssystembuild 22631.3593

davidegiacometti commented 5 months ago

Hi @rka-ppi

I have done a quick test on a Windows 11 machine and I have the new notepad launched. What the Hosts File Editor is doing here is retrieving from the registry the default command associated to the action of edit a text file. Can you open a PowerShell, execute the command below and post the output?

Get-Item -Path Registry::HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\edit\command

/needinfo

EDIT: and of course! In case of error we fallback to the good old notepad.exe. Log file should contain more informations. Can you also reproduce the issue and attach the log file from the following folder %LOCALAPPDATA%\Microsoft\PowerToys\Hosts\Logs\0.81.1.0?

Jay-o-Way commented 5 months ago

retrieving from the registry the default command associated to the action of edit a text file.

@davidegiacometti why not just use (some kind of) ShellExecute command?

rka-ppi commented 5 months ago
Get-Item -Path Registry::HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\edit\command

Hive: HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\edit
Name                           Property
----                           --------
command                        (default) : C:\WINDOWS\system32\NOTEPAD.EXE %1

Well.... Then it's a bug in the Win11 notepad App update mechanism. Strange.

davidegiacometti commented 5 months ago

@davidegiacometti why not just use (some kind of) ShellExecute command?

This won't work since the hosts file doesn't have an extension.

Get-Item -Path Registry::HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\edit\command

Hive: HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\edit
Name                           Property
----                           --------
command                        (default) : C:\WINDOWS\system32\NOTEPAD.EXE %1

Well.... Then it's a bug in the Win11 notepad App update mechanism. Strange.

Woow! Can you confirm that C:\WINDOWS\system32\NOTEPAD.EXE is opening the old notepad on your PC?

rka-ppi commented 5 months ago

Yes... C:\WINDOWS\system32\NOTEPAD.EXE will open the old one.

Taskbar and Explorer Actions will open C:\Program Files\WindowsApps\Microsoft.WindowsNotepad_11.2404.10.0_x64__8wekyb3d8bbwe\Notepad

davidegiacometti commented 5 months ago

Can you confirm that if you right click a txt file in Explorer and click "Edit" it opens the old notepad? That's what the editor is doing.

rka-ppi commented 5 months ago

image Yes I can confirm. Edit bring up the "new" notepad

rka-ppi commented 5 months ago

ok well, there are two entrys.

new Win11 menu: Explorer -> edit in editor brings the new one old Win11 menu: Explorer -> further options -> edit bring the old one