Scripts are written in sysadmin to easily perform daily operations. A good practice of code writing is to develop an algorithm based on the process to be performed in such a way that it might be applied to similar operations. To account for this modularity, we have to pass into the script operations values which apply to the specific sysadmin operation we want to perform.
As many other scripting and programming languages, windows scripting handles parameters as part of a script’s calling. However, there is a limit on the number of parameters that can be handled in windows script routines. To overcome this limitation, we can use the SHIFT command inside a conditional IF loop to “extract” as many parameters as we wish to handle.
The following example uses this logic to concatenate a variable number of strings passed as parameters and sets the value of a variable as a large concatenated string:
IF [%2]== GOTO LOG_ENTRY
SET EVENTO=%EVENTO% %2