PHRAS-2140 Check OS for SMB or NFS folder strategy

This commit is contained in:
Xavier Rousset
2018-07-06 18:11:07 +02:00
parent fcf7d4819d
commit 1bb5421879
2 changed files with 69 additions and 19 deletions

View File

@@ -0,0 +1,23 @@
@echo off
setlocal
setlocal enabledelayedexpansion
rem throw away everything except the IPv4 address line
for /f "usebackq tokens=*" %%a in (`ipconfig ^| findstr /i "ipv4"`) do (
rem we have for example "IPv4 Address. . . . . . . . . . . : 192.168.42.78"
rem split on : and get 2nd token
for /f delims^=^:^ tokens^=2 %%b in ('echo %%a') do (
rem we have " 192.168.42.78"
rem split on . and get 4 tokens (octets)
for /f "tokens=1-4 delims=." %%c in ("%%b") do (
set _o1=%%c
set _o2=%%d
set _o3=%%e
set _o4=%%f
rem strip leading space from first octet
set _3octet=!_o1:~1!.!_o2!.!_o3!.
echo !_3octet!
)
)
)
rem add additional commands here
endlocal