Skip to content

Instantly share code, notes, and snippets.

@etcetra7n
Created April 25, 2025 05:26
Show Gist options
  • Save etcetra7n/b0cca3eceb12f7161ffe5a62be1ad412 to your computer and use it in GitHub Desktop.
Save etcetra7n/b0cca3eceb12f7161ffe5a62be1ad412 to your computer and use it in GitHub Desktop.

ccon.ps1

ccon.ps1 is windows powershell script that will copy a file to clipboard and show a windows toast notification

For this to work you need wintoast.exe in your PATH. I personally got wintoast.exe from Git installation directory

param ([string]$path)
Get-Content "$path" -Raw | Set-Clipboard
$filename = [System.IO.Path]::GetFileName("$path")
Start-Process -FilePath "wintoast.exe" -NoNewWindow -ArgumentList @(
'--appid', 'ccon.ps1',
'--appname', '"Copy content"',
'--text', "`"$filename`"",
'--attribute', '"Filecontent is copied."',
'--expirems', '2',
'--image', 'F:\icons\copy-icon.ico'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment