Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
dir /-c [!]mypath&filename[/!] | find "[!]filename[/!]" > c:\temp.txt
type c:\temp.txt
pause
for /f "tokens=1,2,3,4,5 delims= " %%i in ('type c:\temp.txt') do (
echo i is %%i
echo j is %%j
echo k is %%k
echo l is %%l
echo m is %%m
)
: getsize
@echo off
::
:: Set some useful variables that can be reused
set filepath=[!]some real path with trailing slash[/!]
set filename=[!]the real filename or variable or...[/!]
set extension=[!]the file exension including the . prefix[/!]
::
:: One line of directory listing gets output to a temporary text file
REM This is only because the when using FIND, quotation
REM marks are needed around the string and I couldn't
REM figure out a good way to include it within the
REM FOR command below. There's probably a way around
REM this, but I didn't bother.
dir /-c "%filepath%%filname%%extension%" | find "%filename%" > c:\temp.txt
::
:: Actually get the string out of that line within the temporary file
REM Which token it's in might depend on the actual format of the
REM DIR output used above. I don't know if this format is different
REM for different localizations of Windows. In my case,
REM it's the 4th token which is comes out as variable l
for /f "tokens=1,2,3,4,5 delims= " %%i in ('type c:\temp.txt') do (
echo The size of %filename%%extension% is %%l
set size=%%l
)
::
:: Now do some math or whatever with %size%
pause
cls