China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

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!

中国DOS联盟论坛
The time now is 2026-07-14 23:27
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Help: How to batch rename folder names! View 2,088 Replies 3
Original Poster Posted 2007-01-16 03:01 ·  中国 广西 南宁 西乡塘区 电信
新手上路
Credits 16
Posts 6
Joined 2006-12-18 22:10
19-year member
UID 73879
Gender Male
Status Offline
For example: I have files with the same *.jpg extension in a folder. But the file names are very messy.

I want to uniformly change them to 1.jpg, 2.jpg, 3.jpg, etc.

Thank you.
Floor 2 Posted 2007-01-16 04:02 ·  中国 广西 南宁 西乡塘区 电信
新手上路
Credits 16
Posts 6
Joined 2006-12-18 22:10
19-year member
UID 73879
Gender Male
Status Offline
How to use the `set` here..
Floor 3 Posted 2007-01-16 06:20 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline

  Search first.
Floor 4 Posted 2007-01-17 03:16 ·  中国 山东 济南 电信
社区乞丐
★★
此图片另存后死机
Credits -49
Posts 90
Joined 2006-12-02 13:00
19-year member
UID 72412
Gender Male
Status Offline
It's so strange. So many questions seem to be asked by the same person?? A single code can be used by several people!!


@ECHO %dbg% OFF
setlocal ENABLEDELAYEDEXPANSION

SET NO=0

FOR /F %%i IN ('dir /b *.jpg') DO (
SET /A NO+=1
REN %%i !NO!.JPG
)
我的网络笔记本.非联系本人请勿访问!http://w.vicp.net
Forum Jump: