0

Is there a way natively in Windows to rename multiple selected files in a folder to have a common prefix? Effectively what I want is a way to manually select multiple files, right-click and rename them, but with the option to add a prefix only. I also don't want to install extra software to accomplish this.

I already know about the batch rename by selecting files and pressing F2, but this replaces the entire name and appends a sequential number. I want to keep the current name and only add a prefix.

I also know you can run cmd in the folder and rename files that have common name characters or file attributes, but in my example the files I want to select will not have any shared names and all files in the folder are the same type.

My only solution I can think of is to temporarily move the files to a new folder and batch rename them, then move them back to the original folder. I feel like there has to be a better way than this.

2
  • gci C:\foo\bar -Filter *.xy | % { rename-item $_.FullName -NewName ("Prefix_" + $_.Name) } Commented May 22, 2019 at 8:28
  • @SimonS you don't need to use % because Rename-Item receives a list of file objects, and you don't need $_.FullName either: gci C:\foo\bar -Filter *.xy | ren -NewName ("Prefix_" + $_.Name) } Commented Jun 22, 2021 at 3:07

2 Answers 2

2

You may add a batch file (.bat) to the right-click Send menu (link), or as a Send-menu destination (in %USERPROFILE%\SendTo).

The batch file can handle its parameters using a loop:

@echo off setlocal EnableDelayedExpansion for %%x in (%*) do ( ... ) 

and it can also get the prefix using the SET/P command, then issue the appropriate REN command per each file.

1

There is no built in way, without a batch/powershell script, to rename those files. Especially if they don't have a common pattern you will run into issues. There are various tools you can use to do this but you said you're not willing to install additional software.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.