中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-03 02:14
48,038 主题排行 / 350,123 发帖 / 今日 1 篇 / 48,251 会员排行
DOS批处理 & 脚本技术(批处理室) » 菜鸟求助
可打印版本  740 / 0
第1楼 ffhh 发表于 2007-01-14 16:14
新手上路 发帖 2 积分 8
菜鸟求助
前提是在DOS下使用
想写一条批处理在dos下使用。 先搜索所有硬盘查找ghost.exe,然后列出所有ghost.exe所在目录。 保存为ghostcd.txt然后附值到一个变量%ghostcd%。做出判断,使用哪个ghost文件。例如第一个ghost.exe文件所在路径如 (d:\tools\ghost\ghost)判断是否使用不使用的话将ghostcd.txt第2行引入。直到没有文字为止。
搜索所有硬盘查找ghost.exe我已经写好了
For %%f in (w v u t s r q p o n m l k j i h g f e d c) Do dir/s %%f:\ghost.exe >>1.txt
结果是

Volume in drive E is SUPER

Directory of E:\SIMPCHIN\TOOLS\GHOST

GHOST EXE 1,394,212 10-22-03 14:46
1 file(s) 1,394,212 bytes

Total files listed:
1 file(s) 1,394,212 bytes
0 dir(s) 0 bytes free

Volume in drive D has no label
Volume Serial Number is 0000-8323

Directory of D:\TOOLS\GHOST

GHOST EXE 1,394,212 10-22-03 14:46
1 file(s) 1,394,212 bytes

Total files listed:
1 file(s) 1,394,212 bytes
0 dir(s) 16,357.75 MB free

Volume in drive C has no label
Volume Serial Number is BCBD-854A

Directory of C:\

16,255.81 MB free
我想去掉其他没用的部分生成内容如下的ghostcd.txt
E:\SIMPCHIN\TOOLS\GHOST
D:\TOOLS\GHOST
将每行带入批处理作出选择也不知道怎么写望大家指点12

[ Last edited by ffhh on 2007-1-14 at 03:18 AM ]
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023