bat函数的返回值
set /a nFileSize=0
(
call :getFileSize D:\test1\sendszl2data\20111031\SZSEL2-20111031.tar.gz
echo %nFileSize%
)
(
call :getFileSize D:\test1\sendszl2data\20111031\SZSEL2-20111031.tar.gz
echo %nFileSize%
)
pause
:获取指定文件的大小
:getFileSize
@echo off
set strFilePath=%1%
set /a nFileSize=0
for /f "delims=" %%i in ('dir %strFilePath% /s/b') do set /a nFileSize=%%~zi
echo %nFileSize%
goto :EOF
set /a nFileSize=0
SETLOCAL EnableDelayedExpansion
(
call :getFileSize D:\test1\sendszl2data\20111031\SZSEL2-20111031.tar.gz
echo !nFileSize!
)
(
call :getFileSize D:\test1\sendszl2data\20111031\SZSEL2-20111031.tar.gz
echo !nFileSize!
)
pause
:获取指定文件的大小
:getFileSize
@echo off
set strFilePath=%1%
set /a nFileSize=0
for /f "delims=" %%i in ('dir %strFilePath% /s/b') do set /a nFileSize=%%~zi
echo %nFileSize%
goto :EOF