Text Document and PowerShell Script Menu Customization Parameters

Run this in an elevated PowerShell terminal to clear out conflicting user-choice parameters that block the menu:

Remove-Item "Registry::HKEY_CURRENT_USER\Software\Classes\.txt" -Recurse -ErrorAction SilentlyContinue
Remove-Item "Registry::HKEY_CURRENT_USER\Software\Classes\.ps1" -Recurse -ErrorAction SilentlyContinue

Run this block in an elevated PowerShell prompt to build a proper shell-recognized proxy class for both extensions:

# 1. Setup txt legacy container
New-Item -Path "Registry::HKEY_CLASSES_ROOT\txtlegacy" -Force | Out-Null
Set-Item -Path "Registry::HKEY_CLASSES_ROOT\txtlegacy" -Value "Text Document"
New-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\txtlegacy" -Name "FriendlyTypeName" -Value "Text Document" -Force | Out-Null

New-Item -Path "Registry::HKEY_CLASSES_ROOT\.txt\ShellNew" -Force | Out-Null
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\.txt\ShellNew" -Name "NullFile" -Value ""
Set-Item -Path "Registry::HKEY_CLASSES_ROOT\.txt" -Value "txtlegacy"

# 2. Setup ps1 legacy container
New-Item -Path "Registry::HKEY_CLASSES_ROOT\ps1legacy" -Force | Out-Null
Set-Item -Path "Registry::HKEY_CLASSES_ROOT\ps1legacy" -Value "Windows PowerShell Script"
New-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\ps1legacy" -Name "FriendlyTypeName" -Value "Windows PowerShell Script" -Force | Out-Null

New-Item -Path "Registry::HKEY_CLASSES_ROOT\.ps1\ShellNew" -Force | Out-Null
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\.ps1\ShellNew" -Name "NullFile" -Value ""
Set-Item -Path "Registry::HKEY_CLASSES_ROOT\.ps1" -Value "ps1legacy"

# 3. Force open commands to point to Notepad++
New-Item -Path "Registry::HKEY_CLASSES_ROOT\txtlegacy\shell\open\command" -Force | Out-Null
Set-Item -Path "Registry::HKEY_CLASSES_ROOT\txtlegacy\shell\open\command" -Value '"C:\Program Files\Notepad++\notepad++.exe" "%1"'

New-Item -Path "Registry::HKEY_CLASSES_ROOT\ps1legacy\shell\open\command" -Force | Out-Null
Set-Item -Path "Registry::HKEY_CLASSES_ROOT\ps1legacy\shell\open\command" -Value '"C:\Program Files\Notepad++\notepad++.exe" "%1"'

Copy and paste the following PowerShell block to automatically inject the sorting parameters, BeforeSeparator flags, and custom display names for .txt and .ps1 files:

# 1. Force items above the separator for .txt and .ps1
New-Item -Path "Registry::HKEY_CLASSES_ROOT\.txt\ShellNew\Config" -Force | Out-Null
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\.txt\ShellNew\Config" -Name "BeforeSeparator" -Value ""

New-Item -Path "Registry::HKEY_CLASSES_ROOT\.ps1\ShellNew\Config" -Force | Out-Null
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\.ps1\ShellNew\Config" -Name "BeforeSeparator" -Value ""

# 2. Modify FriendlyTypeName with sorting prefixes (e.g., "0_") to dictate sequence
New-Item -Path "Registry::HKEY_CLASSES_ROOT\txtfile" -Force | Out-Null
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\txtfile" -Name "FriendlyTypeName" -Value "0_Text Document"

New-Item -Path "Registry::HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1" -Force | Out-Null
Set-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1" -Name "FriendlyTypeName" -Value "0_PowerShell Script"

Force Explorer and Shell Refresh

Stop-Process -Name explorer -Force