BATCH SCRIPTING// ARRAYS // Batch Scripting Part -13- ARRAYS

Опубликовано: 30 Март 2026
на канале: Techno Puffin
1,379
19

Go and check out course on Udemy for PowerShell:
https://www.udemy.com/course/powershe...
Title: BATCH SCRIPTING// ARRAYS // Batch Scripting Part 13 ARRAYS


In this lesson, you will be learning about ARRAYS for Batch Script.


Arrays are not specifically defined as a type in Batch Script but can be implemented. The following things need to be noted when arrays are implemented in Batch Script i.e


1.Each element of the array needs to be defined with the set command.
2.The ‘for’ loop would be required to iterate through the values of the array.




Creating an Array : An array is created by using the following set command.


set a[0]=1
Where 0 is the index of the array and 1 is the value assigned to the first element of the array.


Another way to implement arrays is to define a list of values and iterate through the list of values. The following example show how this can be implemented.


Example
@echo off
set list = 1 2 3 4
(for %%a in (%list%) do (
echo %%a
))
Output
The above command produces the following output.
1
2
3
4


Accessing Arrays : You can retrieve a value from the array by using subscript syntax, passing the index of the value you want to retrieve within square brackets immediately after the name of the array.


Example
@echo off
set a[0]=1
echo %a[0]%
In this example, the index starts from 0 which means the first element can be accessed using index as 0, the second element can be accessed using index as 1 and so on. Let's check the following example to create, initialize and access arrays −


@echo off
set a[0] = 1
set a[1] = 2
set a[2] = 3
echo %a[0]%
echo %a[1]%
echo %a[2]%


The above command produces the following output.
1
2
3
=======================================================


If you have any questions, please post them. Don't forget to comment, like, rate and subscribe


=====================================================


Batch file programming tutorial // CREATE BATCH FILE // Batch Scripting Part-1 --    • Batch file programming tutorial // CREATE ...  


Batch file programming tutorial // Batch Scripting Part-2 - Basic Batch Commands --    • Batch file programming tutorial // Batch S...  


Batch file programming tutorial // COPY COMMAND // Batch Scripting Part-3 - COPY Batch Command --    • Batch file programming tutorial // COPY CO...  


Batch file programming tutorial // DEL COMMAND // Batch Scripting Part-4 - DEL Batch Command --    • Batch file programming tutorial // DEL COM...  


Batch file programming tutorial // MOVE COMMAND // Batch Scripting Part-5 - MOVE Batch Command --    • Batch file programming tutorial //MOVE COM...  


Batch file programming tutorial // ATTRIB COMMAND // Batch Scripting Part-6 - ATTRIB Batch Command --    • Batch file programming tutorial // ATTRIB ...  


Batch file programming tutorial // FIND COMMAND // Batch Scripting Part-7 - FIND Batch Command --    • Batch file programming tutorial // FIND CO...  


Batch file programming tutorial // VARIABLES IN BATCH SCRIPT // Batch Scripting Part- 8 - VARIABLES --    • Batch file programming tutorial // VARIABL...  


DO NOT CLICK // LOCAL AND GLOBAL VARIABLES IN BATCH SCRIPT // Part- 9 - LOCAL AND GLOBAL VARIABLES --    • DO NOT CLICK // LOCAL AND GLOBAL VARIABLES...  


BATCH SCRIPTING // STRINGS IN BATCH SCRIPT // Batch Scripting Part- 10 - STRINGS --    • BATCH SCRIPTING // STRINGS IN BATCH SCRIPT...  


BATCH SCRIPTING// LEFT, MID AND RIGHT STRINGS// Batch Scripting Part- 11- LEFT, MID AND RIGHT STRING --    • BATCH SCRIPTING// LEFT, MID AND RIGHT STRI...  


REMOVE AND REPLACE IN STRING // Batch Scripting Part 12 REMOVE AND REPLACE IN STRING --    • REMOVE AND REPLACE IN STRING // Batch Scri...  


======================================================
Check out other videos


WEAPONS THAT CAN DEFEAT THANOS -- https://www.youtube.com/watch?v=nvlez


MS PAINT TRICK -- https://www.youtube.com/watch?v=4IvBC


Matrix Effect --    • Matrix Rain Best Trick// Create Matrix Rai...