If I have a file named 'This Is A File.TXT', how can I rename it in Windows 10 using CMD so that the case changes?
I use Excel on a few-thousand files and generate a CMD script. But the Case of the filename doesn't change.
I've even tried to rename it to 'SS This is a File.txt' (which works), but when I rename it from this to 'This is a File.txt', it reverts to the capitalised filename.
@ECHO OFF
SETLOCAL
SET "targetdir=C:\destdir"
SET "fromname=This Is A File.TXT"
SET "toname=This is a File.txt"
COPY NUL "%targetdir%\%fromname%"
DIR "%targetdir%\this*"
REN "%targetdir%\%fromname%" "%toname%"
DIR "%targetdir%\this*"
GOTO :EOF
produced
Volume in drive C has no label.
Volume Serial Number is 830B-46FADirectory of C:\destdir
15/04/2017 12:45 0 This Is A File.TXT
1 File(s) 0 bytes
0 Dir(s) 82,069,901,312 bytes free
Volume in drive C has no label.
Volume Serial Number is 830B-46FADirectory of C:\destdir
15/04/2017 12:45 0 This is a File.txt
1 File(s) 0 bytes
0 Dir(s) 82,069,901,312 bytes free
for me, both on an NTFS and a USB drive, so it seems to work.