Rename all files in folder to uppercase with batch

batch-filefilefile-management

Is there a way to rename all files in a specific folder to uppercase with batch file?
I found this code. But it renames files to lowercase. How to modify it to rename to uppercase instead?

for /f "Tokens=*" %f in ('dir /l/b/a-d') do (rename "%f" "%f")

Best Solution

@echo off
setlocal enableDelayedExpansion

pushd c:\some_dir

for %%f in (*) do (
   set "filename=%%~f"

   for %%A 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 "filename=!filename:%%A=%%A!"
   )
    ren "%%f" "!filename!" >nul 2>&1
)
endlocal