배치 파일을 실행할 때 다음 오류가 발생합니다 "파일 이름, 디렉터리 이름 또는 볼륨 레이블 구문이 올바르지 않습니다.""파일 이름, 디렉터리 이름 또는 볼륨 레이블 구문이 올바르지 않습니다."일괄 파일 문제가 발생했습니다
내 배치 파일은 정상적으로 실행되지만이 오류는 25 번 팝업되고 계속 진행됩니다. 내가 여기서 무엇을 놓치고 있는지 알 수 없다. ======================================
::This batch file is used to set a static IP and launch Windows Recovery Environment
@setlocal enableextensions enabledelayedexpansion
@echo off
::Setting Static IP Address & DNS Address
netsh interface ipv4 set address "Local Area Connection" static 10.11.111.110 255.255.255.0 10.11.111.249 1
netsh interface ipv4 set dns "Local Area Connection" static 10.11.101.1 primary
::Verify Network Connection
:chklink
set ipaddr=10.11.107.20
set oldstate=neither
set state=down
for /f "tokens=5,7" %%a in ('ping -n 1 !ipaddr!') do (
if "x%%a"=="xReceived" if "x%%b"=="x1," set state=up
)
if not !state!==!oldstate! (
echo.Link is !state!
set oldstate=!state!
)
REM ping -n 2 127.0.0.1 >nul: 2>nul:
SET answer=!state!
IF %answer%==up (
goto recovery
) ELSE (
IF %answer%==down (
::Set static address on NIC 2 if NIC 1 failed
netsh interface ipv4 set address "Local Area Connection 2" static 10.11.111.110 255.255.255.0 10.11.111.249 1
netsh interface ipv4 set dns "Local Area Connection 2" static 10.11.101.1 primary
goto chklink
)
)
::Launch Windows Recovery Environment
:recovery
cls
x:\sources\recovery\recenv.exe
exit
: 다음은 내 코드입니다 =======================
도움이 될 것입니다!
감사합니다.
데릭
시도해 보니 여전히 오류가 많이 발생합니다. –
@Double,'echo off'를 꺼내면 오류가 나타날 때 실행중인 명령을 _ 수신 할 수 있어야합니다. – paxdiablo