.bat final string modifier

March 28, 2009 at 16:54:15
Specs: Windows Vista
Hy to all, i use this script on my .bat file:
FOR /F "skip=1 tokens=3 delims= " %%a IN (IP.txt) DO call :func %%a

and the IP.txt has this inside:

Pinging domainname.est [] with 32 bytes of data:

Request timed out.

and the ending thing is this:


How can i make it to delete the initial "[" and the final "]" ? Is it possible?

Please it's important, thanks in advance!

See More: .bat final string modifier

Report •

March 28, 2009 at 17:58:01
Try using "delims=[]"; you will probably also need to change the token your using from 3 to something else.....

Report •

March 28, 2009 at 19:12:29
It seems to work perfectly also with that "3".

Report •

March 29, 2009 at 02:24:09
If the purpose is to pass the ip to :func...

@echo off & setLocal EnableDelayedExpansion

for /f "tokens=2 delims=[]" %%a in (ip.txt) do (
echo call :func %%a
goto :eof

If at first you don't succeed, you're about average.


Report •

Related Solutions

Ask Question