Jump to content

How get size of physical memory in batch?


IGIdeus

Recommended Posts


IGIdeus,

Like many other posts here there is not enough information in your post for anyone to answer you properly.

What OS do you have? What level is it patched to? What type of language are you programming in?

At anyrate: Check out Microsofts WMI interface. You can easily program it using vbScript (or a lot of other languages). As for getting a DOS batch file to do it that would be more time consuming and require you to run other files from DOS.

Good Luck,

Chesterguy.

Link to comment
Share on other sites

THX for explanation.

Sorry for my inefficiency.

I use "pure" batch files (.bat, .cmd) because most of them should works in Windows NT and XP.

I made my own solution for English XP:

@echo off
FOR /F "tokens=4" %%G IN ('systeminfo ^| find ^"Total Physical Memory^"')  DO (
  if %%G LSS 500 (
     reg /s classic_theme.reg))

Any ideas for improvements?

Best regards

IGIdeus

Link to comment
Share on other sites

Igideus,

It looks like you know your dos batch stuff, better than I still do, if you were able to write and understand that. :)

I have not used NT DOS batch since starting with WSH, WMI with VBScript since they are more powerful, were super easy to get used to, and are Microsoft's prefered method of writing scripts (I still use some Perl, for fun).

It looks like more work but after doing a few you will find its a lot easier. Here is script to determine processor speed and echo it to a window or dos line (depending on how you run it). Copy then paste it into a file with extention ".vbs" (note: WSH 5.6 must be installed).

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colComputer = objWMIService.ExecQuery("Select * from Win32_Processor",,48)

For Each objComputer In colComputer

varCPUSpeed = objComputer.CurrentClockSpeed

Next

wscript.echo "CPUspeed: "&varCPUSpeed

Sorry, I am no help with the DOS. Hope this helped.

Link to comment
Share on other sites

I have not used NT DOS batch since starting with WSH, WMI with VBScript since they are more powerful, were super easy to get used to, and are Microsoft's prefered method of writing scripts (I still use some Perl, for fun).

Sorry, I am no help with the DOS.  Hope this helped.

I should learn WSH, WMI and VBScript if I want to make an extraordinary scripts.

THX a lot :-)

Best regards

IGIdeus

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...