1

I would like to use a PowerShell or batch script to modify an existing expandable string value to another. Specifically, I want to change the default value at

HKEY_CLASSES_ROOT\SystemFileAssociations\image\shell\edit\command

to

"C:\Program Files\Adobe\Adobe Photoshop CC 2015.5\Photoshop.exe" "%1"

I can do this directly in the registry editor, but when I export it as a .reg file, I get a bunch of hex nonsense; obviously that's not very intuitive:

enter image description here

So if I were to use an alternative method instead, such as PowerShell or a batch script, I would hope that I could actually read the path in plain text when viewing the code (since I can't inside the .reg file).

Can this be done with a PowerShell or batch script in a way that keeps the filepath readable?

  • Is that the hex values translated in your screen shot? This means in that hex content, there is a human readable file that and that is what you want to see? – Pimp Juice IT Jul 15 '18 at 0:57
  • @PimpJuiceIT, yes, for some reason whenever you export an Expandable String Value from the registry, the exported .reg file looks like that, even though the actual content I entered into the registry editor field editor was exactly the string above with the path to Photoshop. Because it's so obscured, I hoped that using another method would make it easier to modify the path in the script file itself. – jippyjoe4 Jul 15 '18 at 0:59
1

This can be easily done using PowerShell

New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT

New-ItemProperty -Path "HKCR:\SystemFileAssociations\image\shell\edit\command" -Name "(Default)" -PropertyType ExpandString -Value '"C:\Program Files\Adobe\Adobe Photoshop CC 2015.5\Photoshop.exe" "%1"'

Read about it here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.