Re: Memory output format
- From: "Richard Mueller" <rlmueller-NOSPAM@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 5 Dec 2006 10:15:17 -0600
Rick wrote:
I'm trying to format a string in a VB Script for amount of memory I am
getting from a server. the string is 1073197056, I need to have it show
as a readable number, say 1 gig, I also will have the problem for
systems with 512 and 2 gig etc. Is there a conversion I can do on these
numbers
You can display the number with commas, which makes it much easier to read,
with the FormatNumber function:
lngValue = 1073197056
Wscript.Echo FormatNumber(lngValue, 0)
You can also convert bytes to gigabytes by dividing by 2^30 (1,073,741,824).
Wscript.Echo FormatNumber(lngValue/2^30, 3)
The second parameter in the FormatNumber function is the number of digits to
display after the decimal.
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
.
- Follow-Ups:
- Re: Memory output format
- From: Rick
- Re: Memory output format
- References:
- Memory output format
- From: Rick
- Memory output format
- Prev by Date: Memory output format
- Next by Date: Re: Delete Text from a file
- Previous by thread: Memory output format
- Next by thread: Re: Memory output format
- Index(es):
Relevant Pages
|