Conversation
…r menu Agent-Logs-Url: https://github.com/kilasuit/PowerShell/sessions/d8f9d463-af7b-4937-ae09-47af038e7919 Co-authored-by: kilasuit <6355225+kilasuit@users.noreply.github.com>
| <?endif?> | ||
| <?endif?> | ||
| <!-- Explorer context submenu entries. The ampersand denotes the keyboard shortcut. --> | ||
| <?define ExplorerContextSubMenuDialogText = "Open &here"?> |
There was a problem hiding this comment.
Keep this as we want to allow for default terminal
| <?define ExplorerContextSubMenuDialogText = "Open here in &Conhost"?> | ||
| <?define ExplorerContextSubMenuTerminalDialogText = "Open here in &Terminal"?> | ||
| <?define ExplorerContextSubMenuNoProfileDialogText = "Open here with &No Profile"?> | ||
| <?define ExplorerContextSubMenuCustomProfileDialogText = "Open here with C&ustom Profile"?> | ||
| <?define ExplorerContextSubMenuElevatedDialogText = "Open here as &Administrator"?> |
There was a problem hiding this comment.
Add the above but also for as Administrator
| private static bool TryCreateJumpListLink(string executablePath, string arguments, string title, bool runAsAdministrator, out IShellLinkW jumpListLink, out string errorMessage) | ||
| { | ||
| jumpListLink = (IShellLinkW)new CShellLink(); | ||
| var nativePropertyStore = (IPropertyStore)jumpListLink; | ||
| jumpListLink.SetPath(executablePath); | ||
| jumpListLink.SetArguments(arguments); | ||
| jumpListLink.SetShowCmd(0); | ||
|
|
||
| if (runAsAdministrator) | ||
| { | ||
| var shellLinkDataList = (IShellLinkDataListW)jumpListLink; | ||
| shellLinkDataList.GetFlags(out uint flags); | ||
| flags |= 0x00800000; // SLDF_ALLOW_LINK_TO_LINK | ||
| flags |= 0x00002000; // SLDF_RUNAS_USER | ||
| shellLinkDataList.SetFlags(flags); | ||
| } | ||
|
|
||
| var pkeyTitle = new PropertyKey(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 2); | ||
| var hResult = nativePropertyStore.SetValue(in pkeyTitle, new PropVariant(title)); | ||
| if (hResult < 0) | ||
| { | ||
| errorMessage = $"SetValue on IPropertyStore with title '{title}' failed with HResult '{hResult}'."; | ||
| return false; | ||
| } | ||
|
|
||
| hResult = nativePropertyStore.Commit(); | ||
| if (hResult < 0) | ||
| { | ||
| errorMessage = $"Commit on IPropertyStore with title '{title}' failed with HResult '{hResult}'."; | ||
| return false; | ||
| } | ||
|
|
||
| errorMessage = string.Empty; | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Is there any way that we can move this to be as part of the installation and not done here as part of a first run?
|
@copilot please read the comments and make the requested changes - i shouldn't have needed to ask you to do this |
Agent-Logs-Url: https://github.com/kilasuit/PowerShell/sessions/bf9072fe-33f2-4567-9ff4-633bb19061d3 Co-authored-by: kilasuit <6355225+kilasuit@users.noreply.github.com>
Implemented in commit Changes made:
Validation run: For the JumpList question: moving that setup to installer time is generally not suitable because JumpList tasks are per-user shell state and are reliably applied in user context at runtime. |
| <data name="OpenInConhost" xml:space="preserve"> | ||
| <value>Open in Conhost</value> | ||
| </data> | ||
| <data name="OpenInTerminal" xml:space="preserve"> | ||
| <value>Open in Terminal</value> | ||
| </data> | ||
| <data name="OpenWithNoProfile" xml:space="preserve"> | ||
| <value>Open with No Profile</value> | ||
| </data> | ||
| <data name="OpenWithCustomProfile" xml:space="preserve"> | ||
| <value>Open with Custom Profile</value> | ||
| </data> |
There was a problem hiding this comment.
These also need to be extended for the admin versions too @copilot
There was a problem hiding this comment.
Done in commit f3721c5c (plus follow-up clarification in b414a68). I added admin-specific ConsoleHost resource strings for all launch modes and updated JumpList entries to use them:
- Open in Conhost as Administrator
- Open in Terminal as Administrator
- Open with No Profile as Administrator
- Open with Custom Profile as Administrator
Screenshot: not available from this headless CI sandbox (no Windows Explorer/JumpList UI session).
| (ConsoleHostStrings.OpenInConhost, cmdPath, string.Empty, false), | ||
| (ConsoleHostStrings.OpenInTerminal, terminalPath, $"-w 0 nt \"{cmdPath}\"", false), | ||
| (ConsoleHostStrings.OpenWithNoProfile, cmdPath, "-NoProfile", false), | ||
| (ConsoleHostStrings.OpenWithCustomProfile, cmdPath, "-NoProfile -Command \"if (Test-Path $PROFILE.CurrentUserCurrentHost) { . $PROFILE.CurrentUserCurrentHost }\"", false), | ||
| (ConsoleHostStrings.RunAsAdministrator, cmdPath, string.Empty, true), |
There was a problem hiding this comment.
Implemented in f3721c5c (with follow-up in b414a68). The JumpList entries at TaskbarJumpList.cs:109-116 now include admin variants for Conhost, Terminal, NoProfile, and Custom Profile.
Screenshot: not available from this headless CI environment (no Windows JumpList UI session).
Agent-Logs-Url: https://github.com/kilasuit/PowerShell/sessions/3b345007-402e-4f4d-8cb0-c64da8232786 Co-authored-by: kilasuit <6355225+kilasuit@users.noreply.github.com>
Agent-Logs-Url: https://github.com/kilasuit/PowerShell/sessions/3b345007-402e-4f4d-8cb0-c64da8232786 Co-authored-by: kilasuit <6355225+kilasuit@users.noreply.github.com>
Agent-Logs-Url: https://github.com/kilasuit/PowerShell/sessions/a4d08f65-e874-4c77-a3cd-fd98a0580925 Co-authored-by: kilasuit <6355225+kilasuit@users.noreply.github.com>
Agent-Logs-Url: https://github.com/kilasuit/PowerShell/sessions/a4d08f65-e874-4c77-a3cd-fd98a0580925 Co-authored-by: kilasuit <6355225+kilasuit@users.noreply.github.com>
All requested updates from the review threads are now in this branch, including the admin extensions in both resources and JumpList entries ( Screenshot: not available from this headless CI environment (no Windows Explorer/JumpList UI session). |
| <?define ExplorerContextSubMenuTerminalDialogText = "Open here in &Terminal"?> | ||
| <?define ExplorerContextSubMenuNoProfileDialogText = "Open here with &No Profile"?> | ||
| <?define ExplorerContextSubMenuCustomProfileDialogText = "Open here with C&ustom Profile"?> | ||
| <?define ExplorerContextSubMenuElevatedDialogText = "Open here as &Administrator"?> | ||
| <?define ExplorerContextSubMenuTerminalElevatedDialogText = "Open here in Terminal as A&dministrator"?> | ||
| <?define ExplorerContextSubMenuNoProfileElevatedDialogText = "Open here with No Profile as Adm&inistrator"?> | ||
| <?define ExplorerContextSubMenuCustomProfileElevatedDialogText = "Open here with Custom Profile as Admi&nistrator"?> |
There was a problem hiding this comment.
This also needs open here in conhost variants
| <data name="OpenInConhost" xml:space="preserve"> | ||
| <value>Open in Conhost</value> | ||
| </data> | ||
| <data name="OpenInTerminal" xml:space="preserve"> | ||
| <value>Open in Terminal</value> | ||
| </data> | ||
| <data name="OpenWithNoProfile" xml:space="preserve"> | ||
| <value>Open with No Profile</value> | ||
| </data> | ||
| <data name="OpenWithCustomProfile" xml:space="preserve"> | ||
| <value>Open with Custom Profile</value> | ||
| </data> | ||
| <data name="OpenInConhostAsAdministrator" xml:space="preserve"> | ||
| <value>Open in Conhost as Administrator</value> | ||
| </data> | ||
| <data name="OpenInTerminalAsAdministrator" xml:space="preserve"> | ||
| <value>Open in Terminal as Administrator</value> | ||
| </data> | ||
| <data name="OpenWithNoProfileAsAdministrator" xml:space="preserve"> | ||
| <value>Open with No Profile as Administrator</value> | ||
| </data> | ||
| <data name="OpenWithCustomProfileAsAdministrator" xml:space="preserve"> | ||
| <value>Open with Custom Profile as Administrator</value> | ||
| </data> |
There was a problem hiding this comment.
this also needs additional entries
| } | ||
| } | ||
|
|
||
| private static bool TryCreateJumpListLink(string executablePath, string arguments, string title, bool runAsAdministrator, out IShellLinkW jumpListLink, out string errorMessage) |
There was a problem hiding this comment.
You've created this but I don't see where it's called at all
|
@copilot I've made additional comments please can you fix these |
Agent-Logs-Url: https://github.com/kilasuit/PowerShell/sessions/34f8bae0-334d-4e96-896b-985023a5c73b Co-authored-by: kilasuit <6355225+kilasuit@users.noreply.github.com>
|
@copilot please retry |
Agent-Logs-Url: https://github.com/kilasuit/PowerShell/sessions/3a9b82f5-d941-4b1e-8fa1-245c5034d145 Co-authored-by: kilasuit <6355225+kilasuit@users.noreply.github.com>
Retried and pushed fixes in |
This change expands Windows shell launch surfaces so PowerShell can be opened from both Explorer context menus and taskbar JumpList with explicit host/profile modes. It adds first-class options for Terminal, NoProfile, and Custom Profile, keeps default-terminal behavior in Explorer, and adds elevated variants for both Explorer and JumpList modes.
Explorer context menu (WiX installer)
assets/wix/Product.wxs:Taskbar JumpList tasks (ConsoleHost)
TaskbarJumpList.cs.wt.exeis present.Localized display strings
ConsoleHostStringsresource entries for launch-mode labels, including standard and admin variants.Installer coverage update
WindowsInstaller.Tests.ps1with focused assertions for the adjusted Explorer menu definitions, including Conhost and elevated Conhost command entries.