Hi All,
Been looking around still unable to figure out how to do this.
How do I rename a file based on the contents of the file, Example File1.txt contains this value 'ABC123,07072006,BCA,128-99' the file need to be rename based on the first 6 characters of the value ie ABC123.txt.
Thanks in advance.
Rename File Name based on the contents of the file
Moderator: DosItHelp
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Something like this (untested):
Code: Select all
for /f %%a in (file.txt) do (
set fname=%%a
goto :process
)
:process
ren file.txt %fname:~0,6%