批处理文件错误,表示ECHO为OFF

naz*_*iye -2 batch-file

我已经写了这个批处理文件代码,但是有这个错误,如果您回答我,我感谢您。

错误是,当我选择2时,它问我要进入期望的站点,但是当我写地址时却出现错误,说ECHO IS OFF

帮助我该怎么做...

@echo off
title trace
:main
echo 1)TRACE GOOGLE
echo 2)TRACE YOUR SITE
set /p choice=          Enter your choice:
echo %choice%
if %choice%==1 ( 
  tracert www.google.com
  goto main
  pause >nul
)
if %choice%==2 (
  set /p s=Enter your desired site:
  echo %s%
  pause >nul
)
pause >nul
Run Code Online (Sandbox Code Playgroud)

tri*_*eee 5

这不是错误消息,而是在echo没有参数的情况下运行时发生的情况。换句话说,您看到这是因为%s%结束时是空的。