The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!
@echo off
setlocal
REM replace X below with the 1st octect.....
ipconfig | find /i "x.16"
if %errorlevel%==0 set subnet=16
ipconfig | find /i "x.17"
if %errorlevel%==0 set subnet=17
if %subnet%==16 "\\path\to\your\app.exe"
if %subnet%==17 "\\path\to\your\other\app.exe"
:end
endlocal
exit
@ECHO OFF
FOR /F "Tokens=2 Delims=:" %%a IN ('IPConfig.exe ^| FIND /I "IP" ^| FIND /I "Address" ^| FIND /I /V "IPv6" ') DO SET "Subnet=%%~na"&SET "Host=%%~xa"&GOTO Next
:Next
ECHO Subnet is "%Subnet%" and host is "%Host%"
SET "Site=Unknown"
IF /I "%Subnet%"==" x.y.10" SET "Site=SiteA"
IF /I "%Subnet%"==" x.y.20" SET "Site=SiteB"
IF /I "%Subnet%"==" x.y.30" SET "Site=SiteC"
IF /I "%Subnet%"==" x.y.40" SET "Site=SiteD"
IF /I "%Subnet%"==" 192.168.1" SET "Site=SiteE"
IF /I "%Subnet%"==" 128.127.1" SET "Site=Dragon-IT"
ECHO Site is "%Site%"
GOTO :EOF
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
Open in new window