Guest User

Untitled

a guest
May 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. [check for filesize]
  2. IF %file% [filesize thing Bigger than] GOTO No
  3. echo Great! Your filesize is smaller than %somany% kbytes.
  4. pause
  5. exit
  6. :no
  7. echo Um... You have a big filesize.
  8. pause
  9. exit
  10.  
  11. @echo off
  12. setlocal
  13. set file="test.cmd"
  14. set maxbytesize=1000
  15.  
  16. FOR /F "usebackq" %%A IN ('%file%') DO set size=%%~zA
  17.  
  18. if %size% LSS %maxbytesize% (
  19. echo.File is ^< %maxbytesize% bytes
  20. ) ELSE (
  21. echo.File is ^>= %maxbytesize% bytes
  22. )
  23.  
  24. C:> call /?
  25.  
  26. C:> if /?
  27.  
  28. @ECHO OFF
  29. SET SIZELIMIT=1000
  30. SET FILESIZE=%~z1
  31.  
  32. IF %FILESIZE% GTR %SIZELIMIT% Goto No
  33.  
  34. ECHO Great! Your filesize is smaller than %SIZELIMIT% kbytes.
  35. PAUSE
  36. GOTO :EOF
  37.  
  38. :No
  39. ECHO Um ... You have a big filesize.
  40. PAUSE
  41. GOTO :EOF
  42.  
  43. @echo %~z1
  44.  
  45. Set objFS = CreateObject("Scripting.FileSystemObject")
  46. Set wshArgs = WScript.Arguments
  47. strFile = wshArgs(0)
  48. WScript.Echo objFS.GetFile(strFile).Size & " bytes"
  49.  
  50. C:test>cscript /nologo filesize.vbs file.txt
  51. 79 bytes
  52.  
  53. >dir thing
Add Comment
Please, Sign In to add comment