Was making a batch and ended up with a little problem.
If you for example got the following:
Set HelloThere1=something
Set HelloThere2=something
Set HelloThere3=something
Set B=Hello
Set C=There1
(Just to describe easy. In my case variable B and C is diffrent everytime)
Is there then anyway to get the batch understand that I'm after to make %B%%C% = variable "HelloThere1"?
This is what I'm working on:
Code: Select all
@echo off
::FORSEND.BAT
:: The batch is suppose to take up multiple IP Address/computernames in a variable, sort them out in diffrent variables, and lastly send a message away to all of them using Net Send with FOR.
echo Type the Users IP Address/computernames seperated with a ","
echo.
Set /p connect=Users IP Address/computername:
FOR /F "delims=, tokens=1" %%A in ("%connect%") do set connect1=%%A
FOR /F "delims=, tokens=2" %%B in ("%connect%") do set connect2=%%B
If Test==Test%connect2% (
Set number=1
Goto SEND
)
FOR /F "delims=, tokens=3" %%C in ("%connect%") do set connect3=%%C
If Test==Test%connect3% (
Set number=2
Goto SEND
)
If not Test==Test%connect3% (
Set number=3
Goto SEND
)
:SEND
FOR /L %%Z in (1,1,%number%) do (
::Here's the problem below. I'm trying to make connect%%Z = %connect1%, %connect2% and %connect3% depending where the FOR command is.
set forsend=connect%%Z
net send %forsend% You got a message!
)
pause
::END
Thanks in advance!