How to add 'Edit or Run with' to the right-click menu of PS1 files

A PS1 file is a script or cmdlet, used by Windows PowerShell. This tutorial will show you how to add or remove a custom Edit or Run with menu to the context menu for PowerShell .ps1 files for all users in Windows 10.

The Edit or Run with context menu includes the following items for PS1 files:

  1. Run with PowerShell
  2. Run with PowerShell as administrator
  3. Run with PowerShell 7
  4. Run with PowerShell 7 as administrator
  5. Edit with PowerShell ISE
  6. Edit with PowerShell ISE as administrator
  7. Edit with PowerShell ISE (x86)
  8. Edit with PowerShell ISE (x86) as administrator
  9. Edit with Notepad
  10. Edit with Notepad as administrator

How to add 'Edit or Run with' to the right-click menu of PS1 files Picture 1How to add 'Edit or Run with' to the right-click menu of PS1 files Picture 1

How to add "Edit or Run with" to the right-click menu of PS1 files in Windows 10

Here's how to do it:

Step 1. Do step 2 (add - right click), step 3 (add - Shift + right click) or step 4 (delete) below depending on what you want to do.

Step 2. To add the "Edit or Run with" PS1 file context menu (just right-click to show it), download the Add_Edit_or_Run_with_to_PS1_context_menu.reg file.

Contents of REG file) - Code:

Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT.ps1] [HKEY_CLASSES_ROOT.ps1] @="Microsoft.PowerShellScript.1" [-HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1] [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1] "EditFlags"=dword:00020000 " =hex(2):40.00,22,00,25,00,73,00,79,00,73,00,74,00,65,00,6d, 00,72,00,6f,00, 6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00.6d,00,33,00,32,00.5c, 00,77,00,69,00,6e,00,64,00,6f,00,77,00,73,00,70.00,6f,00,77,00,65,00,72,00, 73,00,68,00,65,00,6c,00,6c,00.5c,00,76,00,31,00,2e,00,30.00, 5c,00,70,00.6f, 00,77,00,65,00,72,00,73,00,68,00,65,00,6c,00,6c,00,2e,00,65,00,78,00,65,00, 22.00.2c,00,2d,00,31,00,30.00,33,00.00,00 [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1DefaultIcon] @=""C:WindowsSystem32WindowsPowerShellv1.0 powershell_ise.exe",1"[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1Shell] @="Open" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellOpenCommand] @=""C:WindowsSystem32notepad.exe" "%1"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-with] "MUIVerb"="Edit or Run with" "Extended"=- "SubCommands"="" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell01flyout] "MUIVerb"="Run with PowerShell" "Icon"="powershell.exe" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell01flyoutCommand] @=""C:WindowsSystem32WindowsPowerShellv1.0powershell.exe" "-Command" "if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell02flyout] "MUIVerb"="Run with PowerShell as administrator" "HasLUashield"="" "Icon"="powershell.exe" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run -withshell02flyoutCommand] @=""C:WindowsSystem32WindowsPowerShellv1.0powershell.exe" "-Command" ""& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy RemoteSigned -File "%1 "' -Verb RunAs}"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell03flyout] "MUIVerb"="Run with PowerShell 7" "Icon"="pwsh.exe" "CommandFlags"=dword:00000020 [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript .1ShellEdit-Run-withshell03flyoutCommand] @=""C:Program FilesPowerShell7pwsh.exe" "-Command" "if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell04flyout] "MUIVerb"="Run with PowerShell 7 as administrator" "HasLUAShield"="" "Icon"="pwsh.exe" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript. 1ShellEdit-Run-withshell04flyoutCommand] @=""C:Program FilesPowerShell7pwsh.exe" "-Command" ""& {Start-Process pwsh.exe -ArgumentList '-ExecutionPolicy RemoteSigned -File "%1 "' -Verb RunAs}"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell05flyout] "MUIVerb"="Edit with PowerShell ISE" "Icon"="powershell_ise.exe" "CommandFlags"=dword:00000020 [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell05flyoutCommand] @=""C: WindowsSystem32WindowsPowerShellv1.0powershell_ise.exe" "%1"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell06flyout] "MUIVerb"="Edit with PowerShell ISE as administrator" "HasLUAShield"="" "Icon "="powershell_ise.exe" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell06flyoutCommand] @="PowerShell -windowstyle hidden -Command "Start-Process cmd -ArgumentList '/s,/c,start PowerShell_ISE.exe ""%1" "'-Verb RunAs"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell07flyout] "MUIVerb"="Edit with PowerShell ISE (x86)" "Icon"="powershell_ise.exe" "CommandFlags"=dword:00000020 [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript 1ShellEdit-Run-withshell07flyoutCommand] @=""C:WINDOWSsyswow64WindowsPowerShellv1.0powershell_ise.exe" "%1"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell08flyout] "MUIVerb"="Edit with PowerShell ISE (x86) as administrator" "HasLUAShield"="" "Icon"="powershell_ise.exe" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell08flyoutCommand] @="PowerShell -windowstyle hidden -Command "Start-Process cmd -ArgumentList '/s,/c,start C:WINDOWSsyswow64WindowsPowerShellv1.0powershell_ise.exe ""%1""' -Verb RunAs"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run -withshell09flyout] "MUIVerb"="Edit with Notepad" "Icon"="notepad.exe" "CommandFlags"=dword:00000020 [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell09flyoutCommand] @=""C:WindowsSystem32 notepad.exe" "%1"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell10flyout] "MUIVerb"="Edit with Notepad as administrator" "HasLUAShield"="" "Icon"="notepad.exe" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript .1ShellEdit-Run-withshell10flyoutCommand] @="PowerShell -windowstyle hidden -Command "Start-Process cmd -ArgumentList '/s,/c,start C:WindowsSystem32notepad.exe ""%1""' -Verb RunAs""

Step 3. To add the "Edit or Run with" PS1 file context menu (Shift + right-click to display), download the Add_Shift + Edit_or_Run_with_to_PS1_context_menu.reg file.

Contents of file REG - Code:

Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT.ps1] [HKEY_CLASSES_ROOT.ps1] @="Microsoft.PowerShellScript.1" [-HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1] [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1] "EditFlags"=dword:00020000 " =hex(2):40.00,22,00,25,00,73,00,79,00,73,00,74,00,65,00,6d, 00,72,00,6f,00, 6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00.6d,00,33,00,32,00.5c, 00,77,00,69,00,6e,00,64,00,6f,00,77,00,73,00,70.00,6f,00,77,00,65,00,72,00, 73,00,68,00,65,00,6c,00,6c,00.5c,00,76,00,31,00,2e,00,30.00,5c,00,70,00.6f, 00,77,00,65,00,72,00,73,00,68,00,65,00,6c,00,6c,00,2e,00,65,00,78,00,65,00, 22.00.2c,00,2d,00,31,00,30.00,33,00.00,00 [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1DefaultIcon] @=""C:WindowsSystem32WindowsPowerShellv1.0 powershell_ise.exe",1"[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1Shell] @="Open" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellOpenCommand] @=""C:WindowsSystem32notepad.exe" "%1"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-with] "MUIVerb"="Edit or Run with" "Extended"="" "SubCommands"="" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell01flyout] "MUIVerb"="Run with PowerShell" "Icon"="powershell.exe " [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell01flyoutCommand] @=""C:WindowsSystem32WindowsPowerShellv1.0powershell.exe" "-Command" "if((Get-ExecutionPolicy ) -ne 'AllSigned'" ) { Set-ExecutionPolicy -Scope Process Bypass };& '%1'"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell02flyout] "MUIVerb"="Run with PowerShell as administrator" "HasLUAShield"="" "Icon"="powershell.exe" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit -Run-withshell02flyoutCommand] @=""C:WindowsSystem32WindowsPowerShellv1.0powershell.exe" "-Command" ""& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy RemoteSigned -File " %1"' -Verb RunAs}"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell03flyout] "MUIVerb"="Run with PowerShell 7" "Icon"="pwsh.exe" "CommandFlags"=dword:00000020 [HKEY_CLASSES_ROOTMicrosoft .PowerShellScript.1ShellEdit-Run-withshell03flyoutCommand] @=""C:Program FilesPowerShell7pwsh.exe" "-Command" "if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell04flyout] "MUIVerb"="Run with PowerShell 7 as administrator" "HasLUAShield"="" "Icon"="pwsh.exe" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript. 1ShellEdit-Run-withshell04flyoutCommand] @=""C:Program FilesPowerShell7pwsh.exe" "-Command" ""& {Start-Process pwsh.exe -ArgumentList '-ExecutionPolicy RemoteSigned -File "%1 "' -Verb RunAs}"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell05flyout] "MUIVerb"="Edit with PowerShell ISE" "Icon"="powershell_ise.exe" "CommandFlags"=dword:00000020 [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell05flyoutCommand] @=""C: WindowsSystem32WindowsPowerShellv1.0powershell_ise.exe" "%1"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell06flyout] "MUIVerb"="Edit with PowerShell ISE as administrator" "HasLUAShield"="" "Icon "="powershell_ise.exe" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell06flyoutCommand] @="PowerShell -windowstyle hidden -Command "Start-Process cmd -ArgumentList '/s,/c,start PowerShell_ISE.exe ""%1" "'-Verb RunAs"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell07flyout] "MUIVerb"="Edit with PowerShell ISE (x86)" "Icon"="powershell_ise.exe" "CommandFlags"=dword:00000020 [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript 1ShellEdit-Run-withshell07flyoutCommand] @=""C:WINDOWSsyswow64WindowsPowerShellv1.0powershell_ise.exe" "%1"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell08flyout] "MUIVerb"="Edit with PowerShell ISE (x86) as administrator" "HasLUAShield"="" "Icon"="powershell_ise.exe" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell08flyoutCommand] @="PowerShell -windowstyle hidden -Command "Start-Process cmd -ArgumentList '/s,/c,start C:WINDOWSsyswow64WindowsPowerShellv1.0powershell_ise.exe ""%1""' -Verb RunAs"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run -withshell09flyout] "MUIVerb"="Edit with Notepad" "Icon"="notepad.exe" "CommandFlags"=dword:00000020 [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell09flyoutCommand] @=""C:WindowsSystem32 notepad.exe" "%1"" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell10flyout] "MUIVerb"="Edit with Notepad as administrator" "HasLUAShield"="" "Icon"="notepad.exe" [HKEY_CLASSES_ROOTMicrosoft.PowerShellScript .1ShellEdit-Run-withshell10flyoutCommand] @="PowerShell -windowstyle hidden -Command "Start-Process cmd -ArgumentList '/s,/c,start C:WindowsSystem32notepad.exe ""%1""' -Verb RunAs""

Step 4. To remove the "Edit or Run with" PS1 file context menu, download the Remove_Edit_or_Run_with_from_PS1_context_menu.reg file.

Contents of file REG - Code:

Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-with]

Step 5. Save the .reg file to the desktop.

Step 6. Double-click the downloaded .reg file to merge.

Step 7. When prompted, click Run > Yes (UAC) > Yes > OK to approve the merge.

Step 8. Now you can delete the downloaded .reg file if you want.

Hope you are succesful.

4 ★ | 1 Vote