中国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-11-11 08:53
47,815 topics / 349,930 posts / today 0 new / 48,291 members
DOS批处理 & 脚本技术(批处理室) » [Solved] How to get n characters starting from a specified character in a string
Printable Version  3,922 / 18
Floor16 nghr Posted 2007-10-21 12:21
初级用户 Posts 34 Credits 88
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!
Floor17 fastslz Posted 2007-10-21 13:21
铂金会员 Posts 2,315 Credits 5,493 From 上海
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 ]
Floor18 nghr Posted 2007-10-21 14:40
初级用户 Posts 34 Credits 88
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
Floor19 wang6610 Posted 2007-10-21 23:01
银牌会员 Posts 488 Credits 1,246
Prev  1 2
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023