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:26
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to get the characters before the double quotation mark View 2,016 Replies 4
Original Poster Posted 2006-12-22 11:50 ·  中国 湖南 常德 电信
新手上路
Credits 12
Posts 4
Joined 2006-12-22 11:24
19-year member
UID 74269
Gender Male
Status Offline
I have a text
The content is as follows
var URL = "adsdt.phpuser=sdfsd1&time=1166712303";

The numbers in it are changing
I now want to take out this number

for /f "tokens=4 delims==" %%i in (z1.txt) do echo %%i > z2.txt
This can only take out
1166712303";

I don't know how to only take out the number
Ask all the experts
Thank you

[ Last edited by namejm on 2006-12-21 at 10:58 PM ]
Floor 2 Posted 2006-12-22 11:58 ·  中国 广东 电信
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
```
@echo off
for /f "tokens=4 delims==" %%i in (test.txt) do set str=%%i
echo %str:~0,-2%
pause
```
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 3 Posted 2006-12-22 11:59 ·  中国 湖南 常德 电信
新手上路
Credits 12
Posts 4
Joined 2006-12-22 11:24
19-year member
UID 74269
Gender Male
Status Offline
Thanks thanks
I know very little about batch processing
I need to study and learn the code from the friend above
:)

Friend, can you explain
echo %str:~0,-2%

Or please give me relevant tutorials to learn, thanks

[ Last edited by roby on 2006-12-21 at 11:01 PM ]
Floor 4 Posted 2006-12-22 12:16 ·  中国 广东 电信
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 5 Posted 2006-12-22 12:21 ·  中国 湖南 常德 电信
新手上路
Credits 12
Posts 4
Joined 2006-12-22 11:24
19-year member
UID 74269
Gender Male
Status Offline
Thank you, moderator.
Learned.
:)
Forum Jump: