Thanks.!
willsort
Moderator
willsort
Moderator
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
How to extract the content of the first line of a txt file and use this line of content to rename this file?
Can multiple files be processed at once?
###
@echo off
setlocal ENABLEDELAYEDEXPANSION
for %%i in (%*) do (
set /p filename=<%%i
ren %%i "!filename!%%~xi"
)
endlocal
Thanks to the moderator first!
But it doesn't seem to work!
Can you explain the function of each line of code, thank you!!!
I changed "%*" to "*.txt" and it works, but it doesn't work for files with space in the file name. I hope the moderator can improve it. ...