When I run my batch file, I get the error "The syntax of the command is incorrect". The error appears right after I type y or n or anything else at the first user input request (userResponse). I've been commenting out the commands in the code one by one, but I still get the error...
Where does it seem to be?
Thanks!
Code:
@echo off
color A
title Trace Route
SETLOCAL ENABLEDELAYEDEXPANSION
:RestartPoint
set /p userResponse="Would you like a list of local devices to trace (y/n)? "
if !userResponse!==y (
net view
set /p IPAddress="Enter the IP address that you would like to trace: "
echo.
set /p addressType="Enter the IP Address type (4 or 6): "
if !addressType!==4 tracert -4 !IPAddress!
if !addressType!==6 tracert -6 !IPAddress!
echo.
:openURLRestartPoint1
set /p userResponseOpenURL="Would you like to map the found IP (y/n)? "
if !userResponseOpenURL!==y (
start "" http://www.ip-adress.com/ip_tracer/
)
if !userResponseOpenURL!==n(
echo.
echo Exiting program...
echo.
PAUSE
) else (
echo.
echo Invalid request. Please try again.
echo.
GOTO openURLRestartPoint1
)
)
if !userResponse!==n (
set /p IPAddress="Enter the IP address that you would like to trace: "
echo.
set /p addressType="Enter the IP Address type (4 or 6): "
if !addressType!==4 tracert -4 !IPAddress!
if !addressType!==6 tracert -6 !IPAddress!
echo.
:openURLRestartPoint2
set /p userResponseOpenURL="Would you like to map the found IP (y/n)? "
if !userResponseOpenURL!==y (
start "" http://www.ip-adress.com/ip_tracer/
)
if !userResponseOpenURL!==n(
echo.
echo Exiting program...
echo.
PAUSE
) else (
echo.
echo Invalid request. Please try again.
echo.
GOTO openURLRestartPoint2
)
) else (
echo.
echo Invalid request. Please try again.
echo.
GOTO RestartPoint
)