|
cocobi
初级用户
 
积分 30
发帖 13
注册 2005-10-11
状态 离线
|
『楼 主』:
[新问题]纯dos输出文本指定行
纯dos下如何输出文本文档的指定行.或读取指定行作为参数.或类似功能.
纯dos的for命令的功能还是太弱了.
[ Last edited by cocobi on 2008-9-22 at 10:04 PM ]
|
|
2008-9-12 13:32 |
|
|
DOSforever
金牌会员
     
积分 4639
发帖 2239
注册 2005-1-30
状态 离线
|
|
2008-9-12 14:35 |
|
|
cocobi
初级用户
 
积分 30
发帖 13
注册 2005-10-11
状态 离线
|
『第
3 楼』:
纯dos下的for不支持 /f参数啊.
@line? 可以给个范例吗?基础不是一般的差的说
我问这个主要是想实现dos下删除win的用户目录下的临时文件.
思路是这样.列出docume~1下的文件夹(用户名作文件夹名)输出到一个文件.
dir %windrv%\docume~1\ /b /ad >winuser.lst
再通过逐行读取这个winuser.lst并把读取的内容设定为一个自定义变量winuser*
再执行
deltree "%windrv%\docume~1\%winuser1%\Local Settings\temp"
deltree "%windrv%\docume~1\%winuser1%\Local Settings\tempor~1"
|
|
2008-9-12 15:35 |
|
|
DOSforever
金牌会员
     
积分 4639
发帖 2239
注册 2005-1-30
状态 离线
|
『第
4 楼』:
以下给出 @line 的具体帮助,你可能不需要用到
Quote: | 4DOS Help Topic: @LINE
@LINE[filename,n]: Returns line n from the specified file. The first line
in the file is numbered 0. "**EOF**" is returned for all line numbers
beyond the end of the file.
@LINE works with files having lines of no more than 511 characters; longer
lines will not be counted accurately.
The @LINE function must read each line of the file to find the line you
request, and will therefore cause significant delays if used in a long loop
or on a large file. For a more effective method of processing each line of
a file in sequence use the FOR command, or @FILEOPEN and a sequence of
@FILEREADs.
You can retrieve input from standard input if you specify CON as the
filename. If you are redirecting input to @LINE using this feature, you
must use command grouping or the redirection will not work properly (you can
pipe to @LINE without a command group; this restriction applies only to
input redirection). For example:
(echo %@line[con,0]) < myfile.dat |
|
windrv 是什么环境变量?你自己定义的?
按照你要达成的目的,可以用 for ,当然是要用 4DOS 下的 for
for /a:d/h %f in (%windrv%\docume~1\*.*) deltree "%f\locals~1\temp"
[ Last edited by DOSforever on 2008-9-12 at 04:09 PM ]
|

DOS倒下了,但永远不死
DOS NEVER DIES !
投票调查:
http://www.cn-dos.net/forum/viewthread.php?tid=46187
本人尚未解决的疑难问题:
http://www.cn-dos.net/forum/viewthread.php?tid=15135
http://www.cn-dos.net/forum/viewthread.php?tid=47663
http://www.cn-dos.net/forum/viewthread.php?tid=48747 |
|
2008-9-12 16:06 |
|
|
cocobi
初级用户
 
积分 30
发帖 13
注册 2005-10-11
状态 离线
|
『第
5 楼』:
Quote: | for /a:d/h %f in (%windrv%\docume~1\*.*) deltree "%f\locals~1\temp" |
|
这个强悍.
看了下4dos 最新版7.5? 可惜是个exe for win9x
按照下面说法好像只要一个4dos.com就可以了
Quote: | 可以用4DOS来代替DOS自带的COMMAND.COM,在CONFIG.SYS里面用
shell=C:\4DOS\4DOS.COM @C:\4DOS\4DOS.INI /P,
在AutoExec.Bat里面加
SET COMSPEC=C:\4DOS\4DOS.COM @C:\4DOS\4DOS.INI /P |
|
看情况改路径就可以对吗?
ps:帮忙上传一个4dos.com.谢谢
|
|
2008-9-12 16:46 |
|
|
DOSforever
金牌会员
     
积分 4639
发帖 2239
注册 2005-1-30
状态 离线
|
|
2008-9-12 17:06 |
|
|
cocobi
初级用户
 
积分 30
发帖 13
注册 2005-10-11
状态 离线
|
『第
7 楼』:
确实可以解压得到4dos.com,好大250k+
确定只需要4dos.com这个文件就可以了吗?OPTION.EXE这个文件可以不要,有什么用没有?
另外批处理编写4dos.com的for的参数因该是%%var吧
for /a:d/h %f in (%windrv%\docume~1\*.*) deltree "%f\locals~1\temp"
应该是
for /a:d/h %%f in (%windrv%\docume~1\*) deltree /y "%%f\locals~1\temp"
吧
|
|
2008-9-12 17:21 |
|
|
DOSforever
金牌会员
     
积分 4639
发帖 2239
注册 2005-1-30
状态 离线
|
|
2008-9-12 17:34 |
|
|
cocobi
初级用户
 
积分 30
发帖 13
注册 2005-10-11
状态 离线
|
『第
9 楼』:
8
keystack? echo.| echo y| 够用了吧.
ps:论坛的命令行界面很有意思.正尝试用它浏览和回帖.
|
|
2008-9-12 17:56 |
|
|
DOSforever
金牌会员
     
积分 4639
发帖 2239
注册 2005-1-30
状态 离线
|
|
2008-9-12 18:06 |
|
|
cocobi
初级用户
 
积分 30
发帖 13
注册 2005-10-11
状态 离线
|
『第
11 楼』:
谢谢你耐心解答和帮助.看了下4dos的说明.好强大.学习中.
|
|
2008-9-12 18:16 |
|
|
DOSforever
金牌会员
     
积分 4639
发帖 2239
注册 2005-1-30
状态 离线
|
|
2008-9-12 18:28 |
|
|
lianjiang2004
金牌会员
     
积分 3946
发帖 1884
注册 2006-1-20
状态 离线
|
『第
13 楼』:
个人理解, 因为很多人把cmd也叫dos,所以写成纯dos,至少不会有人再拿cmd脚本来说事了,可有效避免误解,呵呵。
|

Windows 一键还原
http://www.yjhy.com |
|
2008-9-12 18:51 |
|
|
DOSforever
金牌会员
     
积分 4639
发帖 2239
注册 2005-1-30
状态 离线
|
|
2008-9-12 19:26 |
|
|
lianjiang2004
金牌会员
     
积分 3946
发帖 1884
注册 2006-1-20
状态 离线
|
『第
15 楼』:
上次就碰到一个,问dos下处理的,结果有人写了cmd的脚本,我当时还说,似乎不是楼主想要的,结果还是我理解错了,原来就是要cmd的,呵呵。
所以强调dos,是很有必要的,因为二者不分的人太多了,没办法。呵呵。
|

Windows 一键还原
http://www.yjhy.com |
|
2008-9-12 20:35 |
|