Add suffix to file with context menu in Windows Explorer
Want to add a suffix to (rename) filenames via right click menu.
Like this:
- Right click on file.
- Select the suffix from context menu.
- The file gets renamed.
I tried adding the following registry entry:
HKEY_CLASSES_ROOT
*
shell
old
command
cmd /c ren "%1" "%1 old"
But it results in syntax error.
Would be awesome if it could be used to select and rename multiple files at once.
==> ren /?
Renames a file or files.
RENAME [drive:][path]filename1 filename2.
REN [drive:][path]filename1 filename2.
Note that you cannot specify a new drive or path for your destination file.
==> reg query "HKEY_CLASSES_ROOT\*\shell\Old\command"
HKEY_CLASSES_ROOT\*\shell\Old\command
(Default) REG_SZ cmd /C for %%# in ("%1") do ren "%~f#" "%~n# old%~x#"
Above registry setting leads to e.g. ren "D:\tmp\dummy foo.txt" "dummy foo old.txt"
.
And yes, it could be used to select multiple files at once. Invokes a distinct cmd
instance for every selected file.
Resources (required reading):
- (command reference) An A-Z Index of the Windows CMD command line
- (helpful particularities) Windows CMD Shell Command Line Syntax
- (
%~#
,%~f#
,%~n#
etc. special page) Command Line arguments (Parameters)