How many variables can be used in a batch file

I'm a little curious how many variables I can set in a batch file.

I have a little script here

@ECHO OFF
SETLOCAL EnableDelayedExpansion
FOR /L %%P IN (1,1,2147483647) DO (
    SET Foo[%%P]=%%P
    ECHO !Foo[%%P]!
)

But this script will work forever. So, is there a way to find out the limit on the number of variables? (and, of course, how many variables can be used in a batch file.)

EDIT:

Since the comment below says that var. The amount may vary depending on different OS. Therefore, if you answer, use Windows 7 64bit w/ 4 GB RAMas a guide.

Any help would be appreciated!

+4
source share
1 answer

, , , , .. , , , ( !).

, (, , , ):

  • - 64- ( Itanium).
  • 128 NTFS
  • 32- 4THz () , , .
  • 384 ( )
  • 65807 , Windows 7 sp1 plus 1 .
  • 96783 , Windows 7 sp1 .

, , , - , . int. 2 147 483 647 . , . , 2 : for. 4 294 967 295 , . , , Windows , , 2 147 483 647 . , , (2 147 483 647 - 2) + (4 294 967 295 - (65807 + 1)) + (2 147 483 647 96 963) =

8,589,771,996

( ++)

+4

Source: https://habr.com/ru/post/1664656/


All Articles