.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 [111.111.111.111] with 32 bytes of data:

Request timed out.

and the ending thing is this:

[111.111.111.111]

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 •


#1
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 •

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

Report •

#3
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.

M2


Report •

Related Solutions


Ask Question