I made a batch file to calculate free space:
dir C:\|find /i "bytes free" >> drivespacefree.txt
but the out put looks like this:
9 Dir(s) 917,408,808,960 bytes free
I need it to look like this:
917408808960
and then reed that number into a variable %freespace%
then clear the txt file
can someone help me?
Please test this script. The file is not needed so not created. @echo off setlocal enabledelayedexpansion cls for /f "tokens=3" %%1 in ('dir C:\ ^| find /i "bytes free"') do ( set freespace=%%1&set freespace=!freespace:,=! ) echo %freespace%
Please come back & tell us if your problem is resolved.
thankyou, it works perfictly. you even used the same variable name so I just copyed and pasted it into my program and it works perfictly.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |