Когда я запускаю свой командный файл, я получаю сообщение об ошибке «Синтаксис команды неверен». Ошибка появляется сразу после ввода y или n или что-либо еще при первом запросе на вход пользователя (userResponse). Я комментировал команды в коде один за другим, но я все еще получаю ошибку ...Пакетный файл, Синтаксис команды неверен
Где это похоже?
Спасибо!
Код:
@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
)
Вы недостающий пробел перед '(' в 'если userResponseOpenURL = = n ('. Кроме того, метки и gotos не играют хорошо внутри блоков кода, возможно, вы захотите переместить эти метки прямо над их соответствующими операциями' if! userResponse! =='. – SomethingDark