1.

Solve : how to get the file size in batch file , thanks!?

Answer»

Hi, just need to get the file size into a variable from a file set . And this file should be the latest in this set.
I WROTE a batch , but not working , COULD someone tell me why ?

Cheers!

Here is the code:

@ECHO off

setlocal enabledelayedexpansion

for /F %%i in ('dir /od c:\T*a.log') do (
echo %%~zi
setsize=%%~zi

Pause


)


Code: [Select]@echo off

setlocal enabledelayedexpansion

for /f %%i in ('dir c:\T*a.log /od') do (
echo %%~zi
set size=%%~zi
)
pause

I think that should work. I don't think you need setlocal and enabledelayedexpansions for this, though.Quote from: yjwx18 on July 18, 2007, 08:23:42 PM

I wrote a batch , but not working , could someone tell me why ?

setsize=%%~zi

You need a space after "set" and before "size"
Also you need to CHANGE the command

for /f %%i in ('dir /b /od c:\T*a.log') do (


Discussion

No Comment Found