I want to be able to right click on a file or bunch of files and automatically add a prefix(in this case an underscore) to their names.

What I did:

I made a registry command at HKEY_CLASSES_ROOT>*>shell

I named it "example"

I made a sub String value and I named it "command"

I change command Value Data to:

cmd /c ren "%1" "_%1"

whenever I perform this action from context menu it just opens cmd program and completely ignores the command I gave it.


You are omitting the parameter /c.



cmd [[{/c|/k}] ... string]


/c : Carries out the command specified by string and then stops.

  • I included it but it didn't work after that too. – Soorena May 16 '17 at 12:22

After some research I found a way that indirectly does the job you asked. install a third party program named ReNamer. You can use this file as a command line tool.

So instead of using cmd ren command, use

Renamer.exe /rename <predefined-preset> "%1"

The only thing left to explain is the preset that I referred to.

Open ReNamer software and make a preset as you like (for example preset that will add _ prefix to filename) and save that preset, after that you can safely use that preset in command explained.

So the final command in my Registry Key entry is:

"C:\Program Files (x86)\ReNamer\ReNamer.exe" /rename "underscore" "%1"

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.