Skip to content

Instantly share code, notes, and snippets.

@avelardi
Created April 29, 2025 23:29
Show Gist options
  • Save avelardi/510a7a04d1ed8dec9d0a9644b3c5d9ae to your computer and use it in GitHub Desktop.
Save avelardi/510a7a04d1ed8dec9d0a9644b3c5d9ae to your computer and use it in GitHub Desktop.
windows registry entry powershell as custom context menu item - exiftool remove all exif data

Windows registry entry for exif removal via powershell

Shout out to THIS PERSON for dropping a workable command template

This is not written using best practice, hacked it together to make it work.

Notes

  • Needs exiftool installed and in your path unless you change it
  • Context item will output the file to same dir as sha256hash.[orig ext]
  • Note: cmd dumps the %1 param as a codeblock into powershell
  • Exiftool fails quiet so if it doesn't work, edit the flags on exiftool

Vars

$fp is filepath passed from explorer in from cmd

$h is the hash

$ee is file ext

Info

To implement:

  1. Create new reg entry under HKEY_CLASSES_ROOT\SystemFileAssociations\image\shell
  2. Edit value of the key to be the name of what you want the context menu item to be
  3. Create a new command entry under that ex: HKEY_CLASSES_ROOT\SystemFileAssociations\image\shell\ExifRemoval\command
  4. Copy/paste below into the value of that

That's it, hope it helps someone!

Command


cmd.exe /c powershell.exe "&{param ($I = {%1}) ;$fp = $I.ToString();get-filehash $fp | Select-Object -expandProperty Hash -outvariable h;$ee = $fp.ToString().split('.')[-1];Remove-Item -force $h'.'$ee -ErrorAction Ignore;ExifTool.exe `-all= `-m `-q `-q `-o $h'.'$ee $fp}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment