for /f "tokens=4 delims=." %%a in ("%ip%") do (
set ip4=%%a
)
for /f "tokens=1 delims=." %%a in ("%ip%") do (
set ip1=%%a
)
for /f "tokens=2 delims=." %%a in ("%ip%") do (
set ip2=%%a
)
for /f "tokens=3 delims=." %%a in ("%ip%") do (
set ip3=%%a
)
这么累赘的代码简直就是降低效率!
看看什么叫简洁高效:
for /f "tokens=1-4 delims=." %%a in ("%ip%") do (
set ip1=%%a
set ip2=%%b
set ip3=%%c
set ip4=%%d
)