I've used a for loop to split a string by spaces. I've also used a loop to make each word in its own variable such as var1=this, var2=is, var3=a, var4=test. That looks like "set var!count! = %%A"
That works. I just need to recall it. How do I do that? Logically, I think it would look like this: %var%count%%
Can someone explain to me how to get that? If I have the 'count' 1, what do I do to get "var1"?
There is an easy way, you'll need to enable the delayed expansion, so first of all place setlocal enabledelayedexpansion, then use exclamation marks to access these variables. Your script should look like this:
@echo off
setlocal enabledelayedexpansion
:: Here comes your loops to set the variables
echo/!var%count%!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With