Solved How to make a filename uppercase in batch

Dell / Dell dxp051...
July 7, 2011 at 07:16:24
Specs: Microsoft Windows XP Professional, 2.793 GHz / 2046 MB
I've been searching the internet for code to change FILENAMES to all UpperCase letters.

I've found a few lines of code like the following:
FOR /F "tokens=2 delims=-" %%A IN ('FIND "" "%~1" 2ˆ>ˆ&1') DO SET UpCaseText=%%A

but I only get error messages.

I found the following for making everything lowercase, but don't seem to be able to go the other direction:
FOR %%B IN ("%~1") DO (
FOR /F "delims=~" %%A IN ('ECHO %%Bˆ> ~%%B ˆ& DIR /L /B ~%%B') DO (
SET LoCaseText=%%A
DEL /Q ~%%B

I want to change every PDF in a folder to uppercase, but can only use something that windows comes ready for (such as VB or Command Line/Batch files).

See More: How to make a filename uppercase in batch

Report •

July 7, 2011 at 09:09:01
✔ Best Answer
@echo off
pushd Your_Folder
echo.Processing in progress...
for %%i in (*.pdf) do for /F "tokens=1*" %%j in ('find "" "%%i"') do ren "%%i" "%%k"

Report •

July 7, 2011 at 11:49:45
It works, but I'm not understanding how it works? Mind putting a little explanation?

Report •

July 7, 2011 at 13:40:06
This is magic software and it works because I am a wizard! A lesson on Magic:

- for %%i in (*.pdf) do retrieves all files with extension .pdf in the current directory;

- ('find "" "%%i"') scans each file to search the null item ("") and outputs ------- FileName in uppercase chars (HERE IS MAGIC);

- for /F "tokens=1*" %%j in extracts tokens 2 to N delimited by space, i.e. the filename (that may have embedded blanks) marked as %%k internal variable;

- eventually you can rename the original filename %%i to the all uppercase one %%k since Windows allows this operation.

To know more take a look at Harry Potter's Magic Software Summer School.

Report •
Related Solutions

Ask Question