Right-Click Menu
Windows Context Menu offers a convenient way to access various commands based on the selected item. Combining this with PowerShell provides a powerful toolset for managing and automating tasks in Windows.
Here's an example of creating context menu options using PowerShell:
$ContextMenuOption = "Run with Chase Tool"
$ScriptPath = "C:\Path\to\YourPowerShellScript.ps1"
# Create the main context menu option
New-Item -Path "HKCR:\*\shell\$ContextMenuOption" -Force | Out-Null
# Set the command for the context menu option to run the PowerShell script
$command = "PowerShell.exe -ExecutionPolicy Bypass -File '{0}' '%1'" -f $ScriptPath
Set-ItemProperty -Path "HKCR:\*\shell\$ContextMenuOption" -Name "Command" -Value $command
This script will add a context menu option "Run PowerShell Script" for all files (due to the "*"). When you right-click a file and choose this option, it will run the specified Powershell script with the path of the clicked file as an argument.
Note: This assumes Powershell.exe is in your system path. If not, you might need to provide the full path to Powershell.exe. Adjust the script path ($ScriptPath) to point to your Powershell script.