Sorry but that didn't do it. Same error of got was unexpected at this time
Main Topics
Browse All TopicsI am working on a batch file to run a program from the local servers on each subnet. The base of the code was copied directly from another question here on Experts. The code itself does not want to run one it gets to the goto command. Heres a copy of my code If REM the first two lines and un REM the next two i will get errors on those either a syntax error or unexpected | error. Any help would be great.
IPCONFIG |FIND "IP" >TEMPIP.tmp
set IP=%% iecho %IP% >> c:tempip.tmp
REM for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| find "IP Address"') do set GetIP=%%d
REM do set IP=%% iecho %IP% >> c:tempip.tmp
for /f "tokens=3 delims=." %%j in (c:\tempip.tmp) do set SUBNET=%%j
if %SUBNEt%==10 goto 10subnet
if %SUBNET%==12 goto 12subnet
if %SUBNET%==14 goto 14subnet
if %SUBNET%==16 goto 16SUBNET
if %SUBNET%==11 goto 11subnet
if %SUBNET%==15 goto 15subnet
goto ALL_USERS
:16SUBNET
"\\sn1-100835\Apps Installs\Engineering\AutoC
echo Welcome to the 16 subnet!
goto ALL_USERS
:12SUBNET
"\\sy1-100998\apps installs\Engineering\AutoC
echo Welcome to the 100 subnet!
goto ALL_USERS
:10SUBNET
"\\sm1-100997\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:14SUBNET
"\\sa1-100977\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:15SUBNET
"\\sl1-100239\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:ALL_USERS
REM Use this section to perform functions that pertain to all users
goto END
:END
Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
IPCONFIG |FIND "IP" >TEMPIP.txt
set IP=%% iecho %IP% >> c:\tempip.txt
REM for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| find "IP Address"') do set GetIP=%%d
REM do set IP=%% iecho %IP% >> c:tempip.tmp
for /f "tokens=3 delims=." %%j in (c:\tempip.txt) do set SUBNET=%%j
if %SUBNEt%==10 goto mchenry
if %SUBNET%==12 goto yyorkville
if %SUBNET%==14 goto austin
if %SUBNET%==16 goto newlenox
if %SUBNET%==11 goto Chicago
if %SUBNET%==15 goto atlanta
goto ALL_USERS
:newlenox
"\\sn1-100835\Apps Installs\Engineering\AutoC
echo Welcome to the 16 subnet!
goto ALL_USERS
:yorkville
"\\sy1-100998\apps installs\Engineering\AutoC
echo Welcome to the 100 subnet!
goto ALL_USERS
:mchenry
"\\sm1-100997\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:austin
"\\sa1-100977\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:Atlanta
"\\sl1-100239\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:chicago
"\\sc1-100576\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:ALL_USERS
REM Use this section to perform functions that pertain to all users
goto END
:END
setlocal enabledelayedexpansion
IPCONFIG |FIND "IP" >TEMPIP.txt
set IP=%% iecho %IP% >> c:\tempip.txt
REM for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^| find "IP Address"') do set GetIP=%%d
REM do set IP=%% iecho %IP% >> c:tempip.tmp
for /f "tokens=3 delims=." %%j in (c:\tempip.txt) do set SUBNET=%%j
if !SUBNET!==10 goto mchenry
if !SUBNET!==12 goto yyorkville
if !SUBNET!==14 goto austin
if !SUBNET!==16 goto newlenox
if !SUBNET!==11 goto Chicago
if !SUBNET!==15 goto atlanta
goto ALL_USERS
:newlenox
"\\sn1-100835\Apps Installs\Engineering\AutoC
echo Welcome to the 16 subnet!
goto ALL_USERS
:yorkville
"\\sy1-100998\apps installs\Engineering\AutoC
echo Welcome to the 100 subnet!
goto ALL_USERS
:mchenry
"\\sm1-100997\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:austin
"\\sa1-100977\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:Atlanta
"\\sl1-100239\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:chicago
"\\sc1-100576\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:ALL_USERS
REM Use this section to perform functions that pertain to all users
goto END
:END
Found a solution The subnet variable was not working correctly. Changing the variable to pull from an echo of the ip address variable fixed the issue.
FOR /F "TOKENS=2* DELIMS=:" %%A IN ('IPCONFIG /ALL ^| FIND "IP Address"') DO FOR %%B IN (%%A) DO SET IPADDR=%%B
ECHO IP address: %IPADDR%
for /f "TOKENS=3* DELIMS=." %%j in (echo %IPADDR%) do set subnet=%%k
echo SUBNET IS: %subnet%
if %SUBNEt%==10 goto mchenry
if %SUBNET%==12 goto yorkville
if %SUBNET%==14 goto austin
if %SUBNET%==16 goto newlenox
if %SUBNET%==11 goto Chicago
if %SUBNET%==15 goto atlanta
goto ALL_USERS
:newlenox
"\\sn1-100835\Apps Installs\Engineering\AutoC
echo Welcome to the 16 subnet!
goto ALL_USERS
:yorkville
"\\sy1-100998\apps installs\Engineering\AutoC
echo Welcome to the 100 subnet!
goto ALL_USERS
:mchenry
"\\sm1-100997\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:austin
"\\sa1-100977\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:Atlanta
"\\sl1-100239\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:chicago
"\\sc1-100576\apps installs\Engineering\AutoC
echo Welcome to the 250 subnet!
goto ALL_USERS
:ALL_USERS
REM Use this section to perform functions that pertain to all users
goto END
:END
Business Accounts
Answer for Membership
by: knightEknightPosted on 2008-06-04 at 10:42:51ID: 21712282
your labels cannot begin with numeric characters ... try adding an _ to the front-end:
:_16SUBNET
... goto _16SUBNET