标题: 关于 echo 不能echo for的问题
[打印本页]
作者: ooaf
时间: 2007-11-19 23:13
标题: 关于 echo 不能echo for的问题
如何用echo 将下面的代码echo 到一个 bat里?
直接用echo 总出错!特别是echo for 那段!
set alldrive=e f g h i
for %%a in (%alldrive%) do attrib -s -h -r %%a:\autorun.inf && erase %%a:\autorun.inf /q & ren %%a:\autorun.inf `autorun.inf
for %%a in (%alldrive%) do copy %systemroot%\autorun.inf %%a:\ && attrib +s +h +r %%a:\autorun.inf
for %%a in (e f g h i) do copy %systemroot%\autorun.inf %%a:\ && attrib +s +h +r %%a:\autorun.inf
作者: lxmxn
时间: 2007-11-19 23:14
特殊符号钱加^
%变%%,%%变%%%%
自己试试。。。
作者: ooaf
时间: 2007-11-19 23:33
echo for %%%a in (e f g h i) do copy %%systemroot%%\autorun.inf %%%a:\ && attrib +s +h +r %%%a:\autorun.inf >>ae.txt
pause
结果:
找不到路径 - C:\Documents and Settings\Administrator\桌面\%
cmd中:
C:\Documents and Settings\Administrator\桌面>echo for %C:\windows%a:\ && attri
b +s +h +r %\autorun.inf 1>>ae.txt
for %C:\windows%a:\
作者: ooaf
时间: 2007-11-20 15:54
echo 不管用,直接运行for 命令了!
给for 加 " " 都不行,
echo "for %%a in (e f g h i) do copy %%systemroot%%\autorun.inf %%a:\ && attrib +s +h +r %%a:\autorun.inf" >>ae.txt
结果:
"for
%a in (e f g h i) do copy %systemroot%\autorun.inf
%a:\ && attrib +s +h +r
%a:\autorun.inf"
我试过好多次了, 请指教 !
[
Last edited by ooaf on 2007-11-20 at 03:55 PM ]
作者: zh159
时间: 2007-11-20 17:26
除了二楼的,还有:^&^&
作者: upsco
时间: 2007-11-20 17:53
echo for %%%%a in (e f g h i) do copy %systemroot%\autorun.inf %%%%a:\^&^& attrib +s +h +r %%%%a:\autorun.inf >>ae.txt