Difference between revisions of "Windows Batch Script"
Jump to navigation
Jump to search
(→FOR /L) |
|||
Line 18: | Line 18: | ||
*‘/L’ signifies that for loop is used for iterating through a range of values. | *‘/L’ signifies that for loop is used for iterating through a range of values. | ||
*Lower limit is the value from which loop will start until it reaches the Upper limit and the increment is the value with which lower limit will be increased during each iteration | *Lower limit is the value from which loop will start until it reaches the Upper limit and the increment is the value with which lower limit will be increased during each iteration | ||
=== FOR /D=== | |||
FOR /D %y IN (D:\movie\*) DO @ECHO %y | |||
*For looping through directories, ‘/D/ is used. It is illustrated in the above example. |
Revision as of 13:09, 18 August 2021
Windows Batch Script is a crucial instrument for setting up PKC on Windows 10 platform.
Useful Websites
- Batch Script Tutorial on Tutorial Point
- Batch File to Create Formatted Date and Time
- Batch File Programming
Useful Hints
The following special expressions or characters may be useful in understanding Batch Script:
SET /A
SET varibale_name=variable_value :: for assigning numeric value SET /A variable_name=nameric_value
‘/A’ is used for assigning numeric values. Uninitialized variables are empty strings in batch files.
FOR /L
FOR /L %%var_name IN (Lowerlimit, Increment, Upperlimit) Do some_code
- ‘/L’ signifies that for loop is used for iterating through a range of values.
- Lower limit is the value from which loop will start until it reaches the Upper limit and the increment is the value with which lower limit will be increased during each iteration
FOR /D
FOR /D %y IN (D:\movie\*) DO @ECHO %y
- For looping through directories, ‘/D/ is used. It is illustrated in the above example.