First read from file always fails
Posted: 17 Feb 2019 08:39
As titled, the first read from the file always fails, as the displayed output will be "ECHO is off." Subsequent reads will be fine, as the IP address in IP.txt file will be displayed.
Sample output when script is run 3x:
ECHO is off.
192.168.1.1
192.168.1.1
Code: Select all
@echo off
for /F %%A in (C:\Users\user1\Desktop\IP.txt) do (
set F=%%A
echo %F%
)
ECHO is off.
192.168.1.1
192.168.1.1