Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9134493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:40:14+00:00 2026-06-17T08:40:14+00:00

Hello everyone and thanks for your help! I currently have this program that renames

  • 0

Hello everyone and thanks for your help!

I currently have this program that renames a single file to lowercase:

This file is Lowercase.bat

set LC1=%~nx1
set LC1=%LC1:"=%
set LC1=%LC1:A=a%
set LC1=%LC1:B=b%
set LC1=%LC1:C=c%
set LC1=%LC1:D=d%
set LC1=%LC1:E=e%
set LC1=%LC1:F=f%
set LC1=%LC1:G=g%
set LC1=%LC1:H=h%
set LC1=%LC1:I=i%
set LC1=%LC1:J=j%
set LC1=%LC1:K=k%
set LC1=%LC1:L=l%
set LC1=%LC1:M=m%
set LC1=%LC1:N=n%
set LC1=%LC1:O=o%
set LC1=%LC1:P=p%
set LC1=%LC1:Q=q%
set LC1=%LC1:R=r%
set LC1=%LC1:S=s%
set LC1=%LC1:T=t%
set LC1=%LC1:U=u%
set LC1=%LC1:V=v%
set LC1=%LC1:W=w%
set LC1=%LC1:X=x%
set LC1=%LC1:Y=y%
set LC1=%LC1:Z=z%
ren "%1" "%LC1%"

And I have this file that renames (supposively) every file and folder in every subfolder. It does it by calling the above batch multiple times

This is called LowerCaseRecursive.bat

pushd %1
dir *.* /b /a-d /s > lwrcase.log
for /f %%i in ('type lwrcase.log') do call LowerCase "%%i"
del /q lwrcase.log
popd

You call the program by using the command line and say LowerCaseRecursive.bat “C:\Test\”. Everything works fine but it does NOT rename files that include a
So everything works great, but it can’t seem to rename files with a space on them, even though it has the full name in lwrcase.log. The for just parses until the first space.

I’ve little knowledge of windows batch programming, any ideas?

Thanks a lot everyone! If you have any questions about this just ask me.

EDIT: The problem is most likely on the individuals calls to lowercase.bat. Debugging I can see that the call to lowercase.bat already has the entire filename after the space cropped. Meaning that if the file is C:\Hello\My File.txt it will call:

call Lowercase "C:\Hello\My"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:40:15+00:00Added an answer on June 17, 2026 at 8:40 am

    You should read carefully the FOR help, accessed by typing HELP FOR or FOR /? from a command prompt. You will see that FOR /F parses each line into tokens, and the default token delimiters are space and tab.

    You simply need to disable the token parsing by setting DELIMS to nothing. Technically, you should also set EOL to some character that can never start a path. The default EOL character is ;. Any line that begins with ; will be ignored, and ; is valid in folder and file names (though very unusual). A path cannot begin with :, so that is a good choice.

    for /f "eol=: delims=" %%i in ('type lwrcase.log') do call LowerCase "%%i"
    

    EDIT

    Here are some unsolicited improvements to your code 🙂

    Your Lowercase.bat can be made much smaller. This works because the search part of search and replace is case insensitive.

    setlocal enableDelayedExpansion
    set "LC1=%~nx1"
    for %%C in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do (
      set "LC1=!LC1:%%C=%%C!"
    )
    ren %1 "!LC1!"
    exit /b
    

    And your LowerCaseRecursive.bat can also be greatly simplified into a single line.

    for /r %1 %%F in (*) do call LowerCase "%%F"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello everyone and thanks in advance for reading this.. I have the following html
Hello everyone and thanks up front for your time, I am working on a
Hello everyone I have this problem, I had to make a AsyncTask because the
Hello everyone please guide whats wrong with this code that image is not visible
Hello everyone! I have a website which is http://www.urbanelementz.ca ... It's currently in development.
Hello everyone and thanks for helping me. I made this calculator in C# and
Hello everyone I have converted a project in C# to F# that paints the
hello everyone I have this snippet of the code: local fun NTimesF(f, n:int) =
Hello everyone and thanks for viewing this question :) I am an indie to-be-developer
Hello everyone and thank you for your answers and comments. I have a table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.