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-06-29 08:34
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] How to get the content at the specified position of the specified line of a file View 4,195 Replies 20
Floor 16 Posted 2006-10-05 13:00 ·  中国 湖北 武汉 电信
初级用户
Credits 116
Posts 6
Joined 2005-04-01 00:00
21-year member
UID 37688
Gender Male
Status Offline
It is indeed feasible, but what about Unicode? Can we type 1.ini and then look for the required values and generate a new 2.ini?
Floor 17 Posted 2006-10-05 20:09 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Whether it works or not, you'll know it after trying a few times. Actually, besides using type, more can also be used.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 18 Posted 2006-10-05 22:53 ·  中国 湖南 娄底 新化县 电信
银牌会员
★★★
Credits 1,218
Posts 485
Joined 2006-07-21 21:24
19-year member
UID 58987
From 湖南.娄底
Status Offline
Hehe~ Echo followed by a pipeline command is exactly my idea. The code is updated as follows, please test...


@echo off
setlocal enabledelayedexpansion
for /f "tokens=1,2 delims==" %%i in ('more 1.ini ^| findstr /i /c:"ImageFileName" /c:"ImageFileNumber"') do (
set /a num+=1
if !num! lss 3 (
if /i "%%i"=="ImageFileName" set one=%%j
if /i "%%i"=="ImageFileNumber" set two=%%j
)
)
(
echo
echo Name = NEW ERY
echo Source=FD_INFO
echo
echo Image_Name=%one%
echo Image_Count=%two%
echo Image_Size=51200
echo Image_PerDisc=13
echo Image_Language=1033
)>2.ini
pause
Floor 19 Posted 2006-10-06 03:50 ·  中国 湖北 武汉 电信
初级用户
Credits 116
Posts 6
Joined 2005-04-01 00:00
21-year member
UID 37688
Gender Male
Status Offline
Thanks to Pengfei's tireless guidance, the code works.

In urgent need temporarily, and I will definitely study hard in the future.
Floor 20 Posted 2008-10-10 17:06 ·  马来西亚 电信
新手上路
Credits 2
Posts 1
Joined 2008-10-10 14:52
17-year member
UID 127991
Gender Female
Status Offline
Great, just found the big post, urgent need~ Thank you very much~
Floor 21 Posted 2009-06-03 11:53 ·  中国 北京 海淀区 联通
新手上路
Credits 7
Posts 7
Joined 2008-11-11 16:16
17-year member
UID 130661
Gender Male
Status Offline
Do you need to reply to download?
Forum Jump: