中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-23 12:56
47,812 topics / 349,917 posts / today 0 new / 48,273 members
DOS批处理 & 脚本技术(批处理室) » Seeking help: How to delete a specific string from a file/folder name
Printable Version  3,018 / 7
Floor1 danjiang Posted 2011-01-21 11:53
初级用户 Posts 45 Credits 79
Such as some file names are:
x to delete xxxxxxxxxxxxxxxxxxxxxxxx.xxx
xx to delete xxxxxxxxxxxxxxxxxxxxx.xxx
....
xxxxxxxxxxxxxxxxxxxxxxxxx to delete.xxx

How to delete the string [to delete] in the file name

I want to rename, but I don't know how to operate the string.
Floor2 fastemail Posted 2011-01-21 13:02
新手上路 Posts 7 Credits 7
At the same time, I would like to ask, I also encountered such a problem.
I used a software to solve it, but if there is such a batch processing code, then changing the file name will be more arbitrary, right?
Floor3 modestleaner Posted 2011-01-21 13:34
初级用户 Posts 27 Credits 26
Actually, this can be found by searching. I happen to have one here


Just change emale to what you want to delete, and it's done
Floor4 danjiang Posted 2011-01-21 14:26
初级用户 Posts 45 Credits 79
I looked it up, and since I didn't find it, I'm asking.
I don't know how to look up keywords.
Continue to ask, is the format not supporting Chinese?
Floor5 danjiang Posted 2011-01-21 14:29
初级用户 Posts 45 Credits 79
There is a problem with the publication time here again. It took an hour to check.
Floor6 danjiang Posted 2011-01-21 14:40
初级用户 Posts 45 Credits 79
Sorry, I made a mistake just now. It supports Chinese. But I don't know how to support directories.
Floor7 Hanyeguxing Posted 2011-01-21 15:46
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
```
@echo off
for /f "delims=" %%i in ('dir /b/s/a') do (
set "i=%%i"
set "n=%%~nxi"
setlocal enabledelayedexpansion
ren "!i!" "!n:要删除=!"
endlocal
)
```
Floor8 fzkfqzz Posted 2014-05-11 20:37
新手上路 Posts 1 Credits 1
Learned...
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023