中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-02 22:50
48,038 topics / 350,123 posts / today 1 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » Emergency, Get file size in DOS
Printable Version  1,544 / 6
Floor1 sureme Posted 2006-12-27 08:28
新手上路 Posts 6 Credits 16
Requirement: There are two files, D:\35.RMVB and D:\35OK.RMVB. Determine whether the sizes of these two files are the same. If the sizes are the same, delete D:\35.RMVB.
Please give help, little brother is very grateful.
[ Last edited by sureme on 2006-12-26 at 07:34 PM ]
Floor2 namejm Posted 2006-12-27 08:47
荣誉版主 Posts 1,737 Credits 5,226 From 成都
The following is the demonstration code. If it works, just replace the echo statement with the del statement:


[ Last edited by namejm on 2006-12-26 at 10:05 PM ]
Floor3 applecy Posted 2006-12-27 10:33
初级用户 Posts 78 Credits 168
Still a bit unclear...

What does `call set var=%%var%% %%i` mean here? I'm a newbie, sorry.
Floor4 namejm Posted 2006-12-27 11:07
荣誉版主 Posts 1,737 Credits 5,226 From 成都
Originally posted by applecy at 2006-12-26 21:33:
Still a bit unclear```

What does call set var=%%var%% %%i mean``? I'm a newbie``Sorry``

  There is a small error here, %%i should be written as %%~zi, and the code on floor 2 has been corrected.

  This sentence means to obtain the byte sizes of the two files and assign them to var.
Floor5 sureme Posted 2006-12-27 12:39
新手上路 Posts 6 Credits 16
@echo off
for %%i in (D:\35.RMVB D:\35OK.RMVB) do call set var=%%var%% %%~zi
call :comp_size %var%
pause
goto :eof

:comp_size
if %1 equ %2 del D:\35.RMVB
goto :eof
According to the method you said, a fault occurred during execution. At this time, there should be no del.
I don't know if the moderator has tested it?
Floor6 sureme Posted 2006-12-27 12:41
新手上路 Posts 6 Credits 16
Suggest the moderator to translate the code. I'm a beginner. Thanks in advance
Floor7 sureme Posted 2006-12-27 12:44
新手上路 Posts 6 Credits 16
I made a mistake, and the test was successful
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023