I am sending various parameters to batch file. In that i need the parameter next to the “-l” ..
For example : when calling the .bat
Test.bat sampl.exe -s ssss -m mmmm -l path -k kkkk -d dddd
In this i need to extact “path” based on the presence of -l. In general, I need to extract the next parameter to “-l”. Is there a way i could do it ? Please help
The idea is to loop through the list of parameters and if -l is found then call another section that then extracts the next parameter.
The SHIFT, removes the first parameter from the list of available parameters. eg:
If you ran: sampl.exe -s ssss -m mmmm -l path -k kkkk -d dddd
The available parameters would be = -s ssss -m mmmm -l path -k kkkk -d dddd\
If in the script you executed SHIFT, then the available parameters would be = ssss -m mmmm -l path -k kkkk -d dddd
See the code example below: