Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [check for filesize]
- IF %file% [filesize thing Bigger than] GOTO No
- echo Great! Your filesize is smaller than %somany% kbytes.
- pause
- exit
- :no
- echo Um... You have a big filesize.
- pause
- exit
- @echo off
- setlocal
- set file="test.cmd"
- set maxbytesize=1000
- FOR /F "usebackq" %%A IN ('%file%') DO set size=%%~zA
- if %size% LSS %maxbytesize% (
- echo.File is ^< %maxbytesize% bytes
- ) ELSE (
- echo.File is ^>= %maxbytesize% bytes
- )
- C:> call /?
- C:> if /?
- @ECHO OFF
- SET SIZELIMIT=1000
- SET FILESIZE=%~z1
- IF %FILESIZE% GTR %SIZELIMIT% Goto No
- ECHO Great! Your filesize is smaller than %SIZELIMIT% kbytes.
- PAUSE
- GOTO :EOF
- :No
- ECHO Um ... You have a big filesize.
- PAUSE
- GOTO :EOF
- @echo %~z1
- Set objFS = CreateObject("Scripting.FileSystemObject")
- Set wshArgs = WScript.Arguments
- strFile = wshArgs(0)
- WScript.Echo objFS.GetFile(strFile).Size & " bytes"
- C:test>cscript /nologo filesize.vbs file.txt
- 79 bytes
- >dir thing
Add Comment
Please, Sign In to add comment