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-08-06 09:25
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Solved] How to get n characters starting from a specified character in a string View 3,269 Replies 18
Floor 16 Posted 2007-10-21 12:21 ·  中国 浙江 台州 电信
初级用户
Credits 88
Posts 34
Joined 2007-10-20 14:06
18-year member
UID 100256
Gender Male
Status Offline
Originally posted by slore at 2007-10-21 12:17 PM:

The most difficult thing is extracting numbers, right? Can't you modify it yourself? Sweat~

Modified it, thanks for brother's guidance, I've just started to learn batch processing, sorry!
Floor 17 Posted 2007-10-21 13:21 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Stupid way to find and filter without deleting

@echo off
dir /s /a-d /b /x >tmp.txt
type tmp.txt|find /i /v "sp2qfe" >tmp1.txt
type tmp1.txt|find /i /v "update" >tmp2.txt
type tmp2.txt|find /i /v "%~n0" >tmp3.txt
for /f "delims=*" %%i in (tmp3.txt) do echo del /f /s /q %%i
del tmp*.txt 2>nul
dir /s /ad /b >tmp.txt
type tmp.txt|find /i /v "sp2qfe" >tmp1.txt
type tmp1.txt|find /i /v "update" >tmp2.txt
for /f "delims=*" %%i in (tmp2.txt) do echo rd /q %%i
del tmp*.txt 2>nul
pause
This batch script is very destructive when the red echo part is removed, especially in the root directory. Please use it with caution. I am not responsible.

[ Last edited by fastslz on 2007-10-21 at 01:22 PM ]
第一高手 第二高手

Floor 18 Posted 2007-10-21 14:40 ·  中国 浙江 台州 电信
初级用户
Credits 88
Posts 34
Joined 2007-10-20 14:06
18-year member
UID 100256
Gender Male
Status Offline
Originally posted by fastslz at 2007-10-21 01:21 PM:
Clumsy method: find and filter without deleting
@echo off
dir /s /a-d /b /x >tmp.txt
type tmp.txt|find /i /v "sp2qfe" >tmp1.txt
type tmp1.txt|find /i /v "update" >tmp2.txt
type t ...

Strong, I admire you
Floor 19 Posted 2007-10-21 23:01 ·  中国 山东 菏泽 联通
银牌会员
★★★
Credits 1,246
Posts 488
Joined 2003-11-11 00:00
22-year member
UID 12699
Gender Male
Status Offline
Forum Jump: