Skip to content

Instantly share code, notes, and snippets.

@KyleMit KyleMit/archive.ps1
Last active May 7, 2020

What would you like to do?
Execute Powershell Script on Right Click in Windows Explorer

When you double click a .reg file, it will automatically install in the registry (cmd regedit)

The basic registry pattern is:


Adding the \Background to the key will also add the context menu to an already open folder


Characters in the command need to be escaped twice, once on parsing into the registry, and once on execution

Available commands to pass are %L or %V

$path = $args[0]
Add-Type -AssemblyName PresentationFramework
[System.Windows.MessageBox]::Show("Hello $path")
Windows Registry Editor Version 5.00
@="&Archive Folder"
@="C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -File \"C:\\scripts\\archive\\archive.ps1\" \"%L\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.