早教吧作业答案频道 -->其他-->
批处理forindo输出指定内容@echooffcd\workfor/f%%zin('findstr/s/i/m"read=0"*.*')do(\x05for/f"tokens=1,*delims=="%%ain('find"Ftd"^
题目详情
批处理for in do输出指定内容
@echo off
cd \work
for /f %%z in ('findstr /s /i /m "read=0" *.*') do (
\x05for /f "tokens=1,* delims==" %%a in ('find "Ftd" ^< %%z') do (
\x05\x05for /f "tokens=1,* delims==" %%c in ('find "inipath" ^< %%z') do (
\x05\x05\x05for /f "tokens=1,* delims==" %%e in ('find "cam" ^< %%z') do (
\x05\x05\x05\x05for /f "tokens=1,* delims==" %%g in ('find "arjpath" ^< %%z') do (
\x05\x05\x05\x05echo Ftd= %v% inipath= %w% cam= %x% arjpath= %y%
\x05\x05\x05\x05)
\x05\x05\x05)
\x05\x05)
\x05)
)
按我的设想,findstr输出work目录下所有包含read=0的文件.用find取多个值以后用echo输出
结果,只有findstr输出的最后一个文件被echo输出,其余的都没有显示 结果类似
Ftd= 19854 inipath= v:\work\ddd\ cam= HP aeppath= arjpath
Ftd= 19854 inipath= v:\work\ddd\ cam= HP aeppath= arjpath
Ftd= 19854 inipath= v:\work\ddd\ cam= HP aeppath= arjpath
Ftd= 19854 inipath= v:\work\ddd\ cam= HP aeppath= arjpath
work目录下有4个子目录符合findstr的搜索条件
set v=%%b
\x05\x05\x05\x05set w=%%d
\x05\x05\x05\x05set x=%%f
\x05\x05\x05\x05set y=%%h
echo Ftd= %v% inipath= %w% cam= %x% arjpath= %y%
额 少贴了几行
@echo off
cd \work
for /f %%z in ('findstr /s /i /m "read=0" *.*') do (
\x05for /f "tokens=1,* delims==" %%a in ('find "Ftd" ^< %%z') do (
\x05\x05for /f "tokens=1,* delims==" %%c in ('find "inipath" ^< %%z') do (
\x05\x05\x05for /f "tokens=1,* delims==" %%e in ('find "cam" ^< %%z') do (
\x05\x05\x05\x05for /f "tokens=1,* delims==" %%g in ('find "arjpath" ^< %%z') do (
\x05\x05\x05\x05echo Ftd= %v% inipath= %w% cam= %x% arjpath= %y%
\x05\x05\x05\x05)
\x05\x05\x05)
\x05\x05)
\x05)
)
按我的设想,findstr输出work目录下所有包含read=0的文件.用find取多个值以后用echo输出
结果,只有findstr输出的最后一个文件被echo输出,其余的都没有显示 结果类似
Ftd= 19854 inipath= v:\work\ddd\ cam= HP aeppath= arjpath
Ftd= 19854 inipath= v:\work\ddd\ cam= HP aeppath= arjpath
Ftd= 19854 inipath= v:\work\ddd\ cam= HP aeppath= arjpath
Ftd= 19854 inipath= v:\work\ddd\ cam= HP aeppath= arjpath
work目录下有4个子目录符合findstr的搜索条件
set v=%%b
\x05\x05\x05\x05set w=%%d
\x05\x05\x05\x05set x=%%f
\x05\x05\x05\x05set y=%%h
echo Ftd= %v% inipath= %w% cam= %x% arjpath= %y%
额 少贴了几行
▼优质解答
答案和解析
当不需要进行变量变换(加减取舍等)时就不要另设变量了,直接
echo Ftd= %%b inipath= %%d cam= %%f arjpath= %%h就行了
如果要赋给变量,则要设置变量延迟扩展setlocal enabledelayedexpansion
并用一对!号代一对%号将变量括起来用,如 !v!代替%v%
echo Ftd= %%b inipath= %%d cam= %%f arjpath= %%h就行了
如果要赋给变量,则要设置变量延迟扩展setlocal enabledelayedexpansion
并用一对!号代一对%号将变量括起来用,如 !v!代替%v%
看了 批处理forindo输出指定...的网友还看了以下:
c语言,用指针编程问题编写函数f,计算并返回半径为r的球体的表面积和体积.编写主函数,输入半径x, 2020-05-12 …
这道题我做对了吗? Never ( ) such an interesting book这道 2020-05-16 …
6.Do you enjoying ____ English?A.read B.reads C.r 2020-05-16 …
1,_____?I read books.A,what1,_____?I read books.A 2020-05-16 …
she will read over 15 books next year.【改为同义句】 she 2020-05-16 …
What do people do in these places?Match the place 2020-05-17 …
批处理forindo输出指定内容@echooffcd\workfor/f%%zin('findst 2020-06-24 …
be动词和do的练习.(be)Tom(read)abooknow?为什么要说IsTomreading 2020-11-15 …
连词成句,在用A-F排列成一段话1.at,whth,a,iawas,my,friends,camp( 2020-11-26 …
下面代码中的“if(key[i].compare(c)==0)return1;”这句语句是什么意思s 2021-02-15 …