Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

How to find system memory in Windows PE.

$
0
0

Hi,

I have written a batch script that runs after WinPE 3.0 loads, which counts the number of POSTs and writes it to a txt file on A:\.

I have added a few more lines to also read the available memory on each POST and write it to a txt file. The memory test portion works under windows, but not in WinPE. In WinPE the script runs but does not show the memory on command prompt nor does it write it to the txt file. Any suggestions would be appreciated. 

Thank you

T.J.

@echo off
echo. This script is counting the # of POSTs.
echo. The POST # value is saved in TEST.txt.
echo.
call :myPOSTTest
for /f "tokens=* delims=" %%x in (A:\TEST.txt)  do echo POST# %%x 
echo.&pause&goto:eof
::--------------------------------------------------------
::-- Function section starts below here
::--------------------------------------------------------
:myPOSTTest    - here starts my function identified by its label  
set var=0

if EXIST A:\TEST.txt (
     for /f %%x in (A:\TEST.txt) do (set /a var=%%x+1)
)

echo %var% >> A:\TEST.txt
::--------------------------------------------------------
::-- Memory report
::--------------------------------------------------------
SETLOCAL
for /f "tokens=3*" %%I in ('systeminfo 2^>nul^|find "Total Physical Memory"') do set "memory=%%J"
ECHO from systeminfo: %memory%
echo %var% >> A:\TESTmem.txt
echo %memory% >> A:\TESTmem.txt
for /f "delims=" %%I in ('wmic memphysical^|find "Physical"') do set "memory=%%I"
FOR %%I IN (%memory:~139%) DO SET memory=%%I&GOTO reportmem
:reportmem
::ECHO from WMIC:%memory%

goto END

:END



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>