Launch from start menu by creating a shortcut to the script and set its target to:
powershell.exe -ExecutionPolicy Bypass -File "C:\path\to\script.ps1"
| # Define the process name | |
| $processName = "flameshot" | |
| # Stop the process if it's running | |
| Get-Process -Name $processName -ErrorAction SilentlyContinue | Stop-Process -Force | |
| # Wait for a moment to ensure the process has stopped | |
| Start-Sleep -Seconds 2 | |
| # Start the process again | |
| Start-Process -FilePath "c:\Program Files\Flameshot\bin\flameshot.exe" |