How could I add a fixed prefix to filename using context menu Item?

0

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.

Soorena

Posted 2017-05-16T11:58:29.383

Reputation: 101

Answers

0

You are omitting the parameter /c.

https://technet.microsoft.com/en-us/library/bb490880.aspx

Syntax

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

Parameters

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

peter

Posted 2017-05-16T11:58:29.383

Reputation: 1

I included it but it didn't work after that too. – Soorena – 2017-05-16T12:22:43.610

0

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"

Soorena

Posted 2017-05-16T11:58:29.383

Reputation: 101