Page 1 of 1

How to measure total and free environment space? (XP SP3)

Posted: 22 Dec 2017 02:24
by MicrosoftIsKillingMe
101 question follows. Some of you superheros can can save your time and skip this because it's kid's stuff.

My setup: on XP I use a LNK (not PIF) to cmd.exe which kicks off ntvdm.exe. (By the way the window and LNK Properties do not have a Memory tab; the properties with a window opened by a PIF DOES have that tab.) The LNK target does not do /E; system32\config.nt does not do /E on SHELL; COMSPEC has no /E; system.ini does not have CommandEnvSize. c:\autoexec.bat and config.sys are 0 bytes. And grr, I can't find the answer in Control Panel/system (or administrative tools). So, I'm embarrassed to say, I'm not sure where I'm setting it, or how big it is :redface:

Is below one correct way to see how much is unused/available, by running MEM /PROGRAM ? Partial results:

Code: Select all

addr   name    size   type
004C40 COMMAND 0004F0 Environment
005140 MEM     000430 Environment
005580 MEM     0174E0 Program
4F0h = 1264 (BTW 5140h minus 4C40h is 1280. 16 overhead?)
430h = 1072 (BTW 5580h minus 5140h is 1088)

So am I using 1072 of 1264? (I was under the belief that only the "used" space is propagated to programs?)

BTW on MEM /C the largest executable is 1200 bytes less than "Total FREE" there. Coincidence?

Sorry to ask such a 101 question but I just can't remember since I last set up XP 15 years ago. I did spend a very large amount of search time before giving up and asking.

Bonus: is config.nt SHELL where I should modify it?

Re: How to measure total and free environment space? (XP SP3)

Posted: 22 Dec 2017 06:20
by SIMMS7400
Hi There -

Every week I send out a report of this information. My script is as follows - adjust as necessary:

Code: Select all

echo ********************************************************>>%logfile%
echo Check Diskspace on %COMPUTERNAME%                       >>%logfile%
echo ********************************************************>>%logfile%

SETLOCAL ENABLEDELAYEDEXPANSION

SET EXT=.peloton.lan 

SET "volume=C:"
FOR /f "tokens=1*delims=:" %%i IN ('fsutil volume diskfree %volume%') DO (
    SET "diskfree=!disktotal!"
    SET "disktotal=!diskavail!"
    SET "diskavail=%%j"
)
FOR /f "tokens=1,2" %%i IN ("%disktotal% %diskavail%") DO SET "disktotal=%%i"& SET "diskavail=%%j"

::-- Prepare SRVR_STATS.txt File --::

IF EXIST "%CD%\%COMPUTERNAME%_INFO.txt" DEL "%CD%\%COMPUTERNAME%_INFO.txt"

>>"%CD%\%COMPUTERNAME%_INFO.txt" (

ECHO *******************************************
ECHO **** I N F A S T R U C T U R E   U S E ****
ECHO -------------------------------------------
ECHO.

ECHO *******************************************
ECHO Computer : %COMPUTERNAME%%EXT% 
ECHO -------------------------------------------
ECHO.
ECHO Statistics for Drive %volume%\
ECHO.
ECHO Total Diskspace   : %disktotal:~0,-9% GB
ECHO Total Diskspace   : %disktotal:~0,-6% MB
ECHO.
ECHO Avail. Disk Space : %diskavail:~0,-9% GB
ECHO Avail. Disk Space : %diskavail:~0,-6% MB
ECHO -------------------------------------------
ECHO.
ECHO *******************************************
ECHO Files over 1 gigabyte displayed below:
ECHO -------------------------------------------
ECHO.
)
ENDLOCAL DISABLEDELAYEDEXPANSION

::-- Convert Bytes to Gigsbytes ^& and spool to output file --::

FOR /F "tokens=1,2*" %%A IN (
  'robocopy c:\ c:\ /l /s /is /njh /njs /ndl /nc /min:1073741824 /xj'
  ) DO (
	ECHO %%C\File Size ^= %%A GB >> "%CD%\%COMPUTERNAME%_INFO.txt"
)

Re: How to measure total and free environment space? (XP SP3)

Posted: 22 Dec 2017 07:47
by miskox
Correct the typo:

Code: Select all

ECHO **** I N F A S T R U C T U R E   U S E ****
Inf R astructure.

Saso

Re: How to measure total and free environment space? (XP SP3)

Posted: 22 Dec 2017 11:14
by Aacini
Although not exactly what you asked for, perhaps you may be interested in this thread.

Antonio

Re: How to measure total and free environment space? (XP SP3)

Posted: 22 Dec 2017 13:49
by MicrosoftIsKillingMe
Thank you very much Aacini, though I'm unsure if that will get me there. Jeez, I find it hard to believe that env size info is not provided without having to run something. Even just having to check file contents (like config.nt) feels like too much work (for some; I don't mind it myself), because I would think that SOMEWHERE there's a GUI display of total environment size, if not also total amount currently used. (Well, the properties on a PIF file show starting env size, but I don't even use a PIF file anymore to open DOS) (or do I? When I run the LNK does it utilize the PIF in the same directory?)

Re: How to measure total and free environment space? (XP SP3)

Posted: 22 Dec 2017 14:04
by MicrosoftIsKillingMe
Pretty elaborate stuff there! I need to try your File Manager. I'm hanging on to Elftree on the XP (which is incredible but only with 8+3); I haven't figure what to use for 7/8/10 - explorer and folder windows are so ridiculously lame. "Folder size" 3rd party tool looks interesting.