@echo off
setlocal enabledelayedexpansion
for /f %%a in ('dir /b^|find /c ".exe"') do set /a SUM=%%a
应该写成find /c /i ".exe",使用/i来忽略exe字符的大小写
应该写成set SUM=%%a,/a是用来运算的,直接赋值时不需要
set N=0
这个set N=0可以不用,在运算时,set会为不存在的变量自动赋值为0。
for /f "delims=" %%i in ('dir /b *.exe') do (
set /a N+=1
echo 正在更新,请稍后 (%N%/%SUM%^)...
"%%i" /quiet /norestart
cls
)
%N%应该写成!N!,否则N的值将不被扩展
pause
你的代码可以写成这样:
@echo off
for /f %%a in ('dir /b^|find /i /c ".exe"') do for /f "delims=" %%i in ('dir /b *.exe') do (
set /a N+=1&call echo 正在更新,请稍后 (%%N%%/%%a^)...
"%%i" /quiet /norestart
cls)
pause
Last edited by Hanyeguxing on 2010-3-19 at 21:21 ]