mirror of
https://github.com/ScoopInstaller/Main.git
synced 2025-11-01 06:11:20 +00:00
pwsh: add context menu (explorer, file) (#3411)
* pwsh: add context menu (explorer, file) * pwsh: fix regedit script line ending * pwsh: rename to powershell core, rewrite post_install script * change regedit path from powershell7 to powershellcore as a name Co-authored-by: Gitea <gitea@fake.local>
This commit is contained in:
parent
0cf1ddb258
commit
8f41760f3e
@ -3,6 +3,10 @@
|
|||||||
"description": "Cross-platform automation and configuration tool/framework, known as Powershell Core, that works well with existing tools and is optimized for dealing with structured data.",
|
"description": "Cross-platform automation and configuration tool/framework, known as Powershell Core, that works well with existing tools and is optimized for dealing with structured data.",
|
||||||
"homepage": "https://github.com/PowerShell/PowerShell",
|
"homepage": "https://github.com/PowerShell/PowerShell",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"notes": [
|
||||||
|
"Add PowerShell Core as a explorer context menu by running: '$dir\\install-explorer-context.reg'",
|
||||||
|
"For file context menu, run '$dir\\install-file-context.reg'"
|
||||||
|
],
|
||||||
"architecture": {
|
"architecture": {
|
||||||
"64bit": {
|
"64bit": {
|
||||||
"url": "https://github.com/PowerShell/PowerShell/releases/download/v7.2.2/PowerShell-7.2.2-win-x64.zip",
|
"url": "https://github.com/PowerShell/PowerShell/releases/download/v7.2.2/PowerShell-7.2.2-win-x64.zip",
|
||||||
@ -18,6 +22,18 @@
|
|||||||
" if (!(Test-Path \"$persist_dir\\$_\")) { New-Item \"$dir\\$_\" | Out-Null }",
|
" if (!(Test-Path \"$persist_dir\\$_\")) { New-Item \"$dir\\$_\" | Out-Null }",
|
||||||
"}"
|
"}"
|
||||||
],
|
],
|
||||||
|
"post_install": [
|
||||||
|
"if ($architecture -eq '32bit') { $pwshArch = 'x86' } else { $pwshArch = 'x64' }",
|
||||||
|
"$pwshPath = \"$dir\\pwsh.exe\".Replace('\\', '\\\\')",
|
||||||
|
"'install-explorer-context', 'uninstall-explorer-context', 'install-file-context' , 'uninstall-file-context' | ForEach-Object {",
|
||||||
|
" if (Test-Path \"$bucketsdir\\main\\scripts\\pwsh\\$_.reg\") {",
|
||||||
|
" $content = (Get-Content \"$bucketsdir\\main\\scripts\\pwsh\\$_.reg\").Replace('$pwshPath', $pwshPath)",
|
||||||
|
" $content = $content.Replace('$pwshArch', $pwshArch)",
|
||||||
|
" if ($global) { $content = $content.Replace('HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE') }",
|
||||||
|
" Set-Content \"$dir\\$_.reg\" $content -Encoding Ascii -Force",
|
||||||
|
" }",
|
||||||
|
"}"
|
||||||
|
],
|
||||||
"bin": "pwsh.exe",
|
"bin": "pwsh.exe",
|
||||||
"shortcuts": [
|
"shortcuts": [
|
||||||
[
|
[
|
||||||
|
|||||||
41
scripts/pwsh/install-explorer-context.reg
Normal file
41
scripts/pwsh/install-explorer-context.reg
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
Windows Registry Editor Version 5.00
|
||||||
|
|
||||||
|
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\PowerShellCore$pwshArch]
|
||||||
|
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\PowerShellCore$pwshArch"
|
||||||
|
"MUIVerb"="&PowerShell Core"
|
||||||
|
"Icon"="$pwshPath"
|
||||||
|
|
||||||
|
[HKEY_CURRENT_USER\Software\Classes\Drive\shell\PowerShellCore$pwshArch]
|
||||||
|
"MUIVerb"="&PowerShell Core"
|
||||||
|
"Icon"="$pwshPath"
|
||||||
|
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\PowerShellCore$pwshArch"
|
||||||
|
|
||||||
|
[HKEY_CURRENT_USER\Software\Classes\DesktopBackground\Shell\PowerShellCore$pwshArch]
|
||||||
|
"MUIVerb"="&PowerShell Core"
|
||||||
|
"Icon"="$pwshPath"
|
||||||
|
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\PowerShellCore$pwshArch"
|
||||||
|
|
||||||
|
[HKEY_CURRENT_USER\Software\Classes\Directory\shell\PowerShellCore$pwshArch]
|
||||||
|
"MUIVerb"="&PowerShell Core"
|
||||||
|
"Icon"="$pwshPath"
|
||||||
|
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\PowerShellCore$pwshArch"
|
||||||
|
|
||||||
|
[HKEY_CURRENT_USER\Software\Classes\LibraryFolder\background\shell\PowerShellCore$pwshArch]
|
||||||
|
"MUIVerb"="&PowerShell Core"
|
||||||
|
"Icon"="$pwshPath"
|
||||||
|
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\PowerShellCore$pwshArch"
|
||||||
|
|
||||||
|
[HKEY_CLASSES_ROOT\Directory\ContextMenus\PowerShellCore$pwshArch\shell\openpwsh]
|
||||||
|
"MUIVerb"="Open &here"
|
||||||
|
"Icon"="$pwshPath"
|
||||||
|
|
||||||
|
[HKEY_CURRENT_USER\Software\Classes\Directory\ContextMenus\PowerShellCore$pwshArch\shell\openpwsh\command]
|
||||||
|
@="$pwshPath -NoExit -RemoveWorkingDirectoryTrailingCharacter -WorkingDirectory \"%V!\" -Command \"$host.UI.RawUI.WindowTitle = 'PowerShell Core ($pwshArch)'\""
|
||||||
|
|
||||||
|
[HKEY_CURRENT_USER\Software\Classes\Directory\ContextMenus\PowerShellCore$pwshArch\shell\runas]
|
||||||
|
"MUIVerb"="Open here as &Administrator"
|
||||||
|
"Icon"="$pwshPath"
|
||||||
|
"HasLUAShield"=""
|
||||||
|
|
||||||
|
[HKEY_CURRENT_USER\Software\Classes\Directory\ContextMenus\PowerShellCore$pwshArch\shell\runas\command]
|
||||||
|
@="$pwshPath -NoExit -RemoveWorkingDirectoryTrailingCharacter -WorkingDirectory \"%V!\" -Command \"$host.UI.RawUI.WindowTitle = 'PowerShell Core ($pwshArch)'\""
|
||||||
8
scripts/pwsh/install-file-context.reg
Normal file
8
scripts/pwsh/install-file-context.reg
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Windows Registry Editor Version 5.00
|
||||||
|
|
||||||
|
[HKEY_CURRENT_USER\Software\Classes\*\shell\PowerShellCore$pwshArch]
|
||||||
|
"Icon"="$pwshPath"
|
||||||
|
"MUIVerb"="Run with PowerShell Core"
|
||||||
|
|
||||||
|
[HKEY_CURRENT_USER\Software\Classes\*\shell\PowerShellCore$pwshArch\Command]
|
||||||
|
@="$pwshPath -Command \"$host.UI.RawUI.WindowTitle = 'PowerShell Core ($pwshArch)'; if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'\""
|
||||||
11
scripts/pwsh/uninstall-explorer-context.reg
Normal file
11
scripts/pwsh/uninstall-explorer-context.reg
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Windows Registry Editor Version 5.00
|
||||||
|
|
||||||
|
[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\PowerShellCore$pwshArch]
|
||||||
|
[-HKEY_CURRENT_USER\Software\Classes\Drive\shell\PowerShellCore$pwshArch]
|
||||||
|
[-HKEY_CURRENT_USER\Software\Classes\DesktopBackground\Shell\PowerShellCore$pwshArch]
|
||||||
|
[-HKEY_CURRENT_USER\Software\Classes\Directory\shell\PowerShellCore$pwshArch]
|
||||||
|
[-HKEY_CURRENT_USER\Software\Classes\LibraryFolder\background\shell\PowerShellCore$pwshArch]
|
||||||
|
[-HKEY_CURRENT_USER\Software\Classes\Directory\ContextMenus\PowerShellCore$pwshArch\shell\openpwsh]
|
||||||
|
[-HKEY_CURRENT_USER\Software\Classes\Directory\ContextMenus\PowerShellCore$pwshArch\shell\openpwsh\command]
|
||||||
|
[-HKEY_CURRENT_USER\Software\Classes\Directory\ContextMenus\PowerShellCore$pwshArch\shell\runas]
|
||||||
|
[-HKEY_CURRENT_USER\Software\Classes\Directory\ContextMenus\PowerShellCore$pwshArch\shell\runas\command]
|
||||||
4
scripts/pwsh/uninstall-file-context.reg
Normal file
4
scripts/pwsh/uninstall-file-context.reg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Windows Registry Editor Version 5.00
|
||||||
|
|
||||||
|
[-HKEY_CURRENT_USER\Software\Classes\*\shell\PowerShellCore$pwshArch]
|
||||||
|
[-HKEY_CURRENT_USER\Software\Classes\*\shell\PowerShellCore$pwshArch\Command]
|
||||||
Loading…
x
Reference in New Issue
Block a user