Windows 10: Renaming multiple files using the command prompt Removing alphabet

Discus and support Renaming multiple files using the command prompt Removing alphabet in Windows 10 Software and Apps to solve the problem; Hi, I have the issue of renaming the multiple file by using CMD command. I would like to remove the alphabet or any text value or specific value of... Discussion in 'Windows 10 Software and Apps' started by Phirawit Hongsiri, Jun 4, 2024.

  1. Renaming multiple files using the command prompt Removing alphabet


    Hi, I have the issue of renaming the multiple file by using CMD command. I would like to remove the alphabet or any text value or specific value of these file name and remain only the numeric number. For example Current name Preferred nameBruce Wayne 12345.pdf ---> 12345.pdfMan-bat 30049.pdf ---> 30049.pdfBatman2023.xls ---> 2023.xls Robin5002andbatman.png ---> *** Email address is removed for privacy ***

    :)
     
    Phirawit Hongsiri, Jun 4, 2024
    #1

  2. renaming multiple files using the command prompt

    Hi

    Welcome to Microsoft community.

    It looks like you're on the right track, but the command you're using isn't preserving the unique alphanumeric sequences in each file name. The 'ren' command in Windows doesn't support wildcards in the replacement text, which is why the unique sequences are being removed.

    Instead, you can use a 'for' loop with the 'ren' command to rename each file individually while preserving the unique sequences. Here's how you can do it:

    This command works as follows:

    • for %A in (WI*.*) do This part of the command loops through each file in the current directory that starts with 'WI' and has any extension.
    • ren "%A" "Windsor%~nxA" This part of the command renames each file, replacing 'WI' with 'Windsor' and preserving the rest of the original file name and extension.
    • %~nxA This is a special variable that represents the name and extension of the current file in the loop.
    Please note that you should run this command in the directory where the files you want to rename are located. Also, please ensure to back up your files before running this command, as renaming operations can't be undone.

    Please feel free to let me know if you have any further updates, thanks.

    Best regards

    Derrick Qian | Microsoft Community Support Specialist
     
    Derrick19 - MSFT, Jun 4, 2024
    #2
  3. cwtech Win User
    command prompt will not open in safe mode with command prompt

    Would I just follow the same steps within safe mode after hooking up to the other system?
     
    cwtech, Jun 4, 2024
    #3
  4. Renaming multiple files using the command prompt Removing alphabet

    renaming multiple files using the command prompt

    Hi

    Thanks for your reply.

    I apologize for the confusion. The command provided was intended to append the word "Windsor" before the existing filename, not to replace "WI" with "Windsor". My apologies for misunderstanding your requirements.

    To replace "WI" with "Windsor" in the filenames, you can use a batch script with the ren command. However, the ren command itself doesn't support direct string replacement. You'll need a more powerful scripting language, like PowerShell.

    Here's how you can do it with PowerShell:

    1. Open PowerShell by clicking the Start button, typing 'PowerShell' into the search box, and pressing Enter.
    2. Navigate to the directory containing your files using the cd command. For example: cd C:\path\to\your\files
    3. Run the following command:

    4. This command gets all files starting with 'WI' and renames them by replacing 'WI' with 'Windsor'.
    5. Please be careful when running these commands, and make sure you have a backup of your files, as renaming operations are not easily reversible.
     
    Derrick19 - MSFT, Jun 4, 2024
    #4
Thema:

Renaming multiple files using the command prompt Removing alphabet

Loading...
  1. Renaming multiple files using the command prompt Removing alphabet - Similar Threads - Renaming multiple files

  2. Bat file for renaming multiple files using the command prompt

    in Windows 10 Gaming
    Bat file for renaming multiple files using the command prompt: Greetings,I had a messy .mp4 collection that need intensive naming rework. I have tried using u/Derrick19 guide as followingOpen PowerShell Navigate to the directory containing files using the cd command. For example: cd C:\path\to\your\filesRun the following...
  3. Bat file for renaming multiple files using the command prompt

    in Windows 10 Software and Apps
    Bat file for renaming multiple files using the command prompt: Greetings,I had a messy .mp4 collection that need intensive naming rework. I have tried using u/Derrick19 guide as followingOpen PowerShell Navigate to the directory containing files using the cd command. For example: cd C:\path\to\your\filesRun the following...
  4. Renaming multiple files using the command prompt Removing alphabet

    in Windows 10 Network and Sharing
    Renaming multiple files using the command prompt Removing alphabet: Hi, I have the issue of renaming the multiple file by using CMD command. I would like to remove the alphabet or any text value or specific value of these file name and remain only the numeric number. For example Current name Preferred nameBruce Wayne 12345.pdf --->...
  5. Renaming multiple files using the command prompt Removing alphabet

    in Windows 10 Gaming
    Renaming multiple files using the command prompt Removing alphabet: Hi, I have the issue of renaming the multiple file by using CMD command. I would like to remove the alphabet or any text value or specific value of these file name and remain only the numeric number. For example Current name Preferred nameBruce Wayne 12345.pdf --->...
  6. renaming multiple files using the command prompt

    in Windows 10 Network and Sharing
    renaming multiple files using the command prompt: Hello,I had a few dozen files that used a naming convention beginning with an abbreviation for a city in this case, WI and then an alpha-numeric sequence that was unique to each file. I wanted to rename the files to include the entire city name in this case, Windsor without...
  7. renaming multiple files using the command prompt

    in Windows 10 Gaming
    renaming multiple files using the command prompt: Hello,I had a few dozen files that used a naming convention beginning with an abbreviation for a city in this case, WI and then an alpha-numeric sequence that was unique to each file. I wanted to rename the files to include the entire city name in this case, Windsor without...
  8. renaming multiple files using the command prompt

    in Windows 10 Software and Apps
    renaming multiple files using the command prompt: Hello,I had a few dozen files that used a naming convention beginning with an abbreviation for a city in this case, WI and then an alpha-numeric sequence that was unique to each file. I wanted to rename the files to include the entire city name in this case, Windsor without...
  9. Command Prompt Renaming Files with " and ' in the file name.

    in Windows 10 Network and Sharing
    Command Prompt Renaming Files with " and ' in the file name.: I have a folder with thousands of files with in it. I have been trying to run various batch commands on the files within this folder, however some of these files have " and ' within their filename. Is there some way to either eliminate the problem characters from within the...
  10. "rename" command in Command Prompt

    in Windows 10 Network and Sharing
    "rename" command in Command Prompt: Never thought I'd have another DOS question, but ... never say never, I guess. So I have a folder with sub-folders named with the dates of all the weekdays in April, in the format 2019-04-xx_. I want to change the names to May, i.e. replace "04" with "05". I opened a...