set IBV storage path=D\disk\ibv
set machine name prefix=XP-
set number of clients=200
if %number of clients% leq 9 goto :9
if %number of clients% leq 99 goto :99
if %number of clients% leq 999 goto :999
goto :end
:9
for /l %%i in (1,1,9) do echo "<device name="IBV%%i" target="%machine name prefix%00%%i" file="My Computer\%IBV storage path%\%machine name prefix%00%%i.ibv" mode="3" clustered="no" asyncmode="yes"/>" >>IBVcfg.txt
:99
for /l %%i in (1,1,9) do echo "<device name="IBV%%i" target="%machine name prefix%00%%i" file="My Computer\%IBV storage path%\%machine name prefix%00%%i.ibv" mode="3" clustered="no" asyncmode="yes"/>" >>IBVcfg.txt
for /l %%i in (10,1,%number of clients%) do echo "<device name="IBV%%i" target="%machine name prefix%0%%i" file="My Computer\%IBV storage path%\%machine name prefix%0%%i.ibv" mode="3" clustered="no" asyncmode="yes"/>" >>IBVcfg.txt
:999
for /l %%i in (1,1,9) do echo "<device name="IBV%%i" target="%machine name prefix%00%%i" file="My Computer\%IBV storage path%\%machine name prefix%00%%i.ibv" mode="3" clustered="no" asyncmode="yes"/>" >>IBVcfg.txt
for /l %%i in (10,1,99) do echo "<device name="IBV%%i" target="%machine name prefix%0%%i" file="My Computer\%IBV storage path%\%machine name prefix%0%%i.ibv" mode="3" clustered="no" asyncmode="yes"/>" >>IBVcfg.txt
for /l %%i in (100,1,%number of clients%) do echo "<device name="IBV%%i" target="%machine name prefix%%%i" file="My Computer\%IBV storage path%\%machine name prefix%%%i.ibv" mode="3" clustered="no" asyncmode="yes"/>" >>IBVcfg.txt
:end
After generation, it is like this
"<device name="IBV1" target="XP-001" file="My Computer\D\disk\ibv\XP-001.ibv" mode="3" clustered="no" asyncmode="yes"/>"
Just want to remove the preceding "and the following"
<device name="IBV1" target="XP-001" file="My Computer\D\disk\ibv\XP-001.ibv" mode="3" clustered="no" asyncmode="yes"/>
There is also one that takes the last 3 digits of the machine name and defines it as a variable. Is there a more intuitive way
for /f %%i in ("%computername%") do (
set "name=%%i"
call set "name=%%name:~3,4%%")
set machine name prefix=XP-
set number of clients=200
if %number of clients% leq 9 goto :9
if %number of clients% leq 99 goto :99
if %number of clients% leq 999 goto :999
goto :end
:9
for /l %%i in (1,1,9) do echo "<device name="IBV%%i" target="%machine name prefix%00%%i" file="My Computer\%IBV storage path%\%machine name prefix%00%%i.ibv" mode="3" clustered="no" asyncmode="yes"/>" >>IBVcfg.txt
:99
for /l %%i in (1,1,9) do echo "<device name="IBV%%i" target="%machine name prefix%00%%i" file="My Computer\%IBV storage path%\%machine name prefix%00%%i.ibv" mode="3" clustered="no" asyncmode="yes"/>" >>IBVcfg.txt
for /l %%i in (10,1,%number of clients%) do echo "<device name="IBV%%i" target="%machine name prefix%0%%i" file="My Computer\%IBV storage path%\%machine name prefix%0%%i.ibv" mode="3" clustered="no" asyncmode="yes"/>" >>IBVcfg.txt
:999
for /l %%i in (1,1,9) do echo "<device name="IBV%%i" target="%machine name prefix%00%%i" file="My Computer\%IBV storage path%\%machine name prefix%00%%i.ibv" mode="3" clustered="no" asyncmode="yes"/>" >>IBVcfg.txt
for /l %%i in (10,1,99) do echo "<device name="IBV%%i" target="%machine name prefix%0%%i" file="My Computer\%IBV storage path%\%machine name prefix%0%%i.ibv" mode="3" clustered="no" asyncmode="yes"/>" >>IBVcfg.txt
for /l %%i in (100,1,%number of clients%) do echo "<device name="IBV%%i" target="%machine name prefix%%%i" file="My Computer\%IBV storage path%\%machine name prefix%%%i.ibv" mode="3" clustered="no" asyncmode="yes"/>" >>IBVcfg.txt
:end
After generation, it is like this
"<device name="IBV1" target="XP-001" file="My Computer\D\disk\ibv\XP-001.ibv" mode="3" clustered="no" asyncmode="yes"/>"
Just want to remove the preceding "and the following"
<device name="IBV1" target="XP-001" file="My Computer\D\disk\ibv\XP-001.ibv" mode="3" clustered="no" asyncmode="yes"/>
There is also one that takes the last 3 digits of the machine name and defines it as a variable. Is there a more intuitive way
for /f %%i in ("%computername%") do (
set "name=%%i"
call set "name=%%name:~3,4%%")
