无忧启动论坛

标题: 批处理问题,请教 [打印本页]

作者: huwuyuan    时间: 2002-4-14 01:53
标题: 批处理问题,请教
对了,问你一个问题,
我用dir /b /s *.gho 可以查初当前目录下所以子目录下的*.gho
当批处理dir查出hwy.gho在当前的bin目录下
我是否可以设个差数能自动进到那个目录,
该怎样写批处理??
帮帮我,谢谢!!
作者: huwuyuan    时间: 2002-4-14 01:57
标题: 批处理问题,请教
我用:
for %%1 in (dir /s /b *.gho) do set ghof=%%1
只能查出*.gho 文件!
不知怎么进入那个目录!!
  
作者: Virus2000    时间: 2002-4-14 10:34
标题: 批处理问题,请教
再加一条
cd %%1
行不行啊
作者: pk4321    时间: 2002-4-19 15:15
标题: 批处理问题,请教
[UploadFile=2_3199_3.rar]@echo off
rem 找当前目录(根目录)的*.txt
for %%a in (*.txt) do type %%a
rem 以下为找当前目录(根目录)的所有子目录下的所有*.txt
set i=1
set j=1
set filenum=0
set dirnum=0
varset root=FULL of . >temp.bat
call temp.bat
varset rootdir=string(3) %root% >temp.bat
call temp.bat
dir /ad /b /s >temp.txt
varset dirnum=lines temp.txt >temp.bat
call temp.bat
:loop1
type %root%\temp.txt | %root%\LMOD /L%i% set curdir=[] >%root%\temp.bat
call %root%\temp.bat
varset curdir=string(3) %curdir% >%root%\temp.bat
call %root%\temp.bat
cd %curdir%
echo %curdir%
set j=1
:loop2
        %root%\varset filenum=files *.txt >%root%\temp.bat
        call %root%\temp.bat
        if %filenum%==0 goto end2
        dir *.txt /b | %root%\LMOD /L%j% set curfile=[] >%root%\temp.bat
        call %root%\temp.bat
        type %curfile%
        if %j%==%filenum% goto end2
        %root%\varset j=%j%+1 >%root%\temp.bat
        call %root%\temp.bat
        goto loop2        
:end2
cd %rootdir%
if %i%==%dirnum% goto end1
%root%\varset i=%i%+1 >%root%\temp.bat
call %root%\temp.bat
goto loop1
:end1
del %root%\temp.bat
del %root%\temp.txt
set i=
set j=
set filenum=
set dirnum=
set root=
set rootdir=
set curdir=
set curfile=
作者: 江湖小虾米    时间: 2002-4-19 15:24
标题: 批处理问题,请教
太专业
作者: pk4321    时间: 2002-4-19 15:30
标题: 批处理问题,请教
This is called "Professional"!
作者: 江湖小虾米    时间: 2002-4-19 15:41
标题: 批处理问题,请教
我不懂This is called "Professional"!
作者: pk4321    时间: 2002-4-19 16:28
标题: 批处理问题,请教
其实这个涉及到了数据结构中的树的遍历算法!不知道这里有没有人学过数据结构?




欢迎光临 无忧启动论坛 (http://bbs.c3.wuyou.net/) Powered by Discuz! X3.3