batch file - How to find MB disk size and crate list of variables -


i'm trying automate re-partitioning of many machines using easus command line utility.
can make batch files think i'm out of depth when playing wmi.

my goal find size in mb of both c , d partitions , place them in txt file.
after want basic maths, take 60gb d , give c. c around 20gb , want increase 80gb.

something like:

find c size: cs find d size: ds find d free: df 

is sufficient space available in df resize 60010mb smaller.

if yes ds - 60005mb = ds1  cs+60005 = cs1 ds-60005 = ds1  

run easus command 1 (this resizes d start 60005mb after c, , finnish 5mb before end of drive.

epmconsole.exe resize --disk=0 --volume=1 --start=cs1 --size=ds1 -r  

run easus command 2 run epmconsole.exe" resize --disk=0 --volume=0 --start=0 --size=80000 -r

(i'm guessing 10mb allow easus command line function without error due small partition boundary issues)

get size of drive , place in text file (batch script):

drive=c: /f "tokens=2 delims=:" %%n in ('fsutil volume diskfree %drive% ^| find /i "avail free bytes"') echo %%n > your_text_file.txt 

'set /a' math limited 32bits (4gb in hdd terms) not suited purposes. best use else math. vbscript can it. if must use batch script, can use windows compiled version of 'bc' downloadable @ sourceforge. google 'bc syntax' more.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -