set SourceDir=\\my_server\path
if "%SourceDir:~0,2%"=="\\" (
set sourceHost= REM not sure what to do. here I need to isolate hostname
for /f "tokens=2" %%b in ('nslookup %SourceDir%^|find /i "Address"') do set ser_ip=%%b
REM here I need to replace my_server with %ser_ip%
)
In this code I'm trying to replace the host-name with IP address in a network path.
- in the
set sourceHost= REM not sure what to do. here I need to isolate hostnameLine I need to isolate the hostname from the path - in the
REM here I need to replace my_server with %ser_ip%line need to replace host name with retrieved ip address
if the nslookup ip adress is 10.12.13.14 last result should be \\10.12.13.14\path
Please help me for these two lines. Thank you!