Welcome › Forums › General PowerShell Q&A › Does Verbs() support Submenus
- This topic has 2 replies, 2 voices, and was last updated 6 months, 3 weeks ago by
Participant.
-
AuthorPosts
-
-
July 6, 2020 at 6:35 am #240575
I have written a small piece of code which displays context menu forĀ Devices&Printers. This does not work for menu items, which have submenus.
$o = new-object -com Shell.Application
$folder = $o.NameSpace(“shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}”)
foreach ($item in $folder.Items())
{
If ($item.Name -eq ‘iCR6X–1613950’)
{# below does not print menu items which have submenu
$item.Verbs()
}
}Any help is appreciated.
Rohan
-
July 6, 2020 at 4:22 pm #240662
Both of these show the items I’d expect. They are not blank. Not sure why they would be blank for you?
PowerShell12345678foreach ($item in $folder.Items()){$item.name}foreach ($item in $folder.Items()){foreach($verb in $item.verbs()){$verb.name}}Some of the output
PowerShell1234567891011121314151617CutePDF WriterHP USB Optical MouseMicrosoft Print to PDFHP Compaq LA2405 Wide LCD MonitorLogitech H570e MonoFaxLifeCam Cinema&Network settingsS&ound settings&Mouse settings&Keyboard settings&RegionalS&ystem propertiesDevice &installation settingsPo&wer optionsWindows &Update -
July 7, 2020 at 2:55 am #240734
Thanks for the reply.
You can easily reproduce this by using the below powershell script(https://devblogs.microsoft.com/scripting/use-powershell-to-work-with-windows-explorer/), which also does not display menu containing submenus.
$o = new-object -com Shell.Application
$folder = $o.NameSpace(“C:\Windows\System32”)
$file=$folder.ParseName(“notepad.exe”)
$file.Verbs()|select Name-
This reply was modified 6 months, 2 weeks ago by
shetty_rohan04.
-
This reply was modified 6 months, 2 weeks ago by
-
-
AuthorPosts
- The topic ‘Does Verbs() support Submenus’ is closed to new replies.