Install-ChocolateyExplorerMenuItem

Install-ChocolateyExplorerMenuItem

Install-ChocolateyExplorerMenuItem

:choco-info: NOTE

Administrative Access Required.

Creates a windows explorer context menu item that can be associated with a command

Syntax

Install-ChocolateyExplorerMenuItem `
  -MenuKey <String> `
  [-MenuLabel <String>] `
  [-Command <String>] `
  [-Type <String>] `
  [-IgnoredArguments <Object[]>] [<CommonParameters>]

Description

Install-ChocolateyExplorerMenuItem can add an entry in the context menu of Windows Explorer. The menu item is given a text label and a command. The command can be any command accepted on the windows command line. The menu item can be applied to either folder items or file items.

Because this command accesses and edits the root class registry node, it will be elevated to admin.

Notes

This command will assert UAC/Admin privileges on the machine.

Chocolatey will automatically add the path of the file or folder clicked to the command. This is done simply by appending a %1 to the end of the command.

Aliases

None

Examples

EXAMPLE 1


# This will create a context menu item in Windows Explorer when any file
# is right clicked. The menu item will appear with the text "Open with
# Sublime Text 2" and will invoke sublime text 2 when selected.
$sublimeDir = (Get-ChildItem $env:ALLUSERSPROFILE\chocolatey\lib\sublimetext* | select $_.last)
$sublimeExe = "$sublimeDir\tools\sublime_text.exe"
Install-ChocolateyExplorerMenuItem "sublime" "Open with Sublime Text 2" $sublimeExe

EXAMPLE 2


# This will create a context menu item in Windows Explorer when any
# folder is right clicked. The menu item will appear with the text
# "Open with Sublime Text 2" and will invoke sublime text 2 when selected.
$sublimeDir = (Get-ChildItem $env:ALLUSERSPROFILE\chocolatey\lib\sublimetext* | select $_.last)
$sublimeExe = "$sublimeDir\tools\sublime_text.exe"
Install-ChocolateyExplorerMenuItem "sublime" "Open with Sublime Text 2" $sublimeExe "directory"

Inputs

None

Outputs

None

Parameters

-MenuKey <String>

PropertyValue
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false

-MenuLabel [<String>]

PropertyValue
Aliases
Required?false
Position?2
Default Value
Accept Pipeline Input?false

-Command [<String>]

PropertyValue
Aliases
Required?false
Position?3
Default Value
Accept Pipeline Input?false

-Type [<String>]

PropertyValue
Aliases
Required?false
Position?4
Default Valuefile
Accept Pipeline Input?false

-IgnoredArguments [<Object[]>]

PropertyValue
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters http://go.microsoft.com/fwlink/p/?LinkID=113216 .

Function Reference

:choco-info: NOTE

This documentation has been automatically generated from Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" -Force; Get-Help Install-ChocolateyExplorerMenuItem -Full.

View the source for Install-ChocolateyExplorerMenuItem