after writing IP inside txt using PowerShell, I can't read it with batch file
inside txt file
122.237.121.26
$Line = Invoke-RestMethod -Uri "http://ipinfo.io" | select-object -property ip
($Line | Select-String -Pattern "\d{1,3}(\.\d{1,3}){3}" -AllMatches).Matches.Value | Out-File -FilePath C:\src\Newfolder\currentip.txt
For /F UseBackQ^ Delims^=^ EOL^= %%G In ("C:\src\Newfolder\currentip.txt") Do Set "k=%%G"
echo %k%
pause
but if I manually create "currentip.txt" and put ip inside it manually, then run this command
For /F UseBackQ^ Delims^=^ EOL^= %%G In ("C:\src\Newfolder\currentip.txt") Do Set "k=%%G"
echo %k%
pause
I get output, but if I use PowerShell I got this messege
C:\src\Newfolder>For /F UseBackQ Delims= EOL= %G In ("C:\src\Newfolder\currentip.txt") Do Set "k=%G"
C:\src\Newfolder>echo
ECHO is on.
C:\src\Newfolder>pause
Press any key to continue . . .