Hi everybody,
is there a way to convert byte from %i_original_size% to KiloByte, MegaByte or GigaByte ?
Best,
Laurent.
how to convert by to Kb, MB or GB
-
- Posts: 7
- Joined: Mon Nov 21, 2016 10:44 pm
Re: how to convert by to Kb, MB or GB
Ok i wrote a simple vbscript to convert %original_size% from byte to KB,MB,GB or TB,
but i dont know how to retreive the result from a command processor ?
in case the script is here:
but i dont know how to retreive the result from a command processor ?
in case the script is here:
Code: Select all
' convert byte to KB,MB,GB or TB for ffastrans
' call from command line with cscript byteconvert.vbs %original_size%
val = WScript.Arguments.Item(0)
mult = 1024
If val > mult Then
val = val/mult
unit = " KB"
If val > mult Then
val = val/mult
unit = " MB"
If val > mult Then
val = val/mult
unit = " GB"
If val > mult Then
val = val/mult
unit = " TB"
End If
End If
End If
End If
cscript.echo int(val) & unit
Re: how to convert by to Kb, MB or GB
You can use a combination of "Contitional"-nodes to evaluate the size and then use the "Populate"-nodes and math expressions to create integer variables containing the new rounded value in KB, MB or GB.
-steinar
-steinar