Adding Windows Explorer context menus do not work in 20H1

Brass Contributor

If you add Windows Explorer context menus items via the registry they do not work in 20H1.

The example below would create a run as administrator for PowerShell ps1 files in all previous versions of Windows up to and including 1909, but it does not work in 20H1. This is not limited to ps1 files. I cannot create a context menu for any of the file types I have tried.

 

[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\runas\command]
@="powershell.exe \"-Command\" \"if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'\""

 

Similarly if you try to create context sub menus using ExtendedSubCommandsKey these do not work either.

 

They will however work for Directory and Drive keys - as in Open PowerShell Here or cmd here.

 

Can anyone from Microsoft explain?

Pete

2 Replies

I found what has happened here with specifically ps1 files.

HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1 has been removed as a default handler for ps1 files in 20H1.

The handler is now located at HKEY_CLASSES_ROOT\SystemFileAssociations\.ps1\Shell\0. Adding context items here works.

This made my day! Thanks!