Command prompt: checking file size

Discussion in 'Software' started by lio83197, Jan 23, 2007.

  1. lio83197

    lio83197 Private E-2

    Is there a way to check the size of any file with the command prompt?
     
  2. Mada_Milty

    Mada_Milty MajorGeek

    The dir command shows the file size.
     
  3. lio83197

    lio83197 Private E-2

    yea but that shows a list of files, i want to check just one file
     
  4. matt.chugg

    matt.chugg MajorGeek

    I wrote a program called getdetails a while ago to help us in the malware forum.

    DOwnload the attached zip file and copy the exe file to your windows directory. you can then call it using the command line.

    GetDetails c:\windows\system32\shell32.dll

    that will list all file details

    If you want just the size add an 'fs' argument (FileSize) at the end as follows

    GetDetails c:\windows\system32\shell32.dll fs

    That should work

    There are other command but I don't have the list at the moment I will post it once I finish digging around the admin forum for my original post with it.

    Ignore the NULL file in the zip, thats just to makew the zip different from the one uploaded in our admin forum as you cannot upload 2 files with the same checksum.
     

    Attached Files:

    Last edited: Feb 8, 2007
  5. Alaskapro

    Alaskapro Private E-2

    Either CD to the directory that contains the file you want to check then:-

    dir 'filename'

    or

    dir 'full-path'\'filename'
     
  6. lio83197

    lio83197 Private E-2

    Thank you, I found out how to do it using C++. Thank you for your help guys.
     
  7. sofokly

    sofokly Private E-2

    i have downloaded the getdetails.zip and it worked well with me . but my question how can i put the file size i have gotten in an variable ?? please reply me quickly
     
  8. GermanOne

    GermanOne Guest

    You need a FOR /F loop.
    Code:
    @echo off &setlocal
    for /f "tokens=2" %%i in ('GetDetails "c:\wherever\file.ext" fs') do set "size=%%i"
    echo %size%
    pause
    
    Regards
    GermanOne
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds