• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 349
  • Last Modified:

batch commands extracted automatically from txt file

ok i want to get location specific information from customers via web page have it posted to a text file this is easy but it post in parenthises
and exaple of wot i want is customer says they are in miami florida so the form  posts the dns server for that location is 64.63.62.61(example only not real
the text document titled pingtest.txt
says


"ping 127.0.0.1>>log.txt"
"ping 64.63.62.61>>log.txt"
"ping 64.63.62.1>>log.txt"



i need these exact lines but without the parentises
if not for them i would just have it rename automatically
ren pingtest.txt pingtest.bat
but the  parenthises prevents it from being run able and i cant figure out how to save it to the text without
i need a way to extract the parts of the lines i need to a bat automatically or a way to save them without the parentises
i hope that i have been speciffic enouph please help me
0
ttnnkkrr
Asked:
ttnnkkrr
  • 3
  • 2
1 Solution
 
pbarretteCommented:
Hi ttnnkkrr,

Do you mean parenthesis () or quotation marks ""?

Either way, this will work for Win2K/XP:
:: ----STRIPCHAR.BAT-----
@ECHO OFF
FOR /F "DELIMS=" %%F IN (PINGTEST.TXT) DO (
 SET LINE=%%F
 CALL :STRIP
)
GOTO END
:STRIP
ECHO LINE=%LINE:~1,-1%>>PINGTEST.BAT
:END
CALL PINGTEST.BAT
:: ----STRIPCHAR.BAT-----

pb
0
 
ttnnkkrrAuthor Commented:
thank you i apologise for not accepting this answer right away i have been out of town i look at ur profile and i think your name should be batch man im gonna try your suggestion and give u an answer tonight some time i see that 200 is alot of points for the norm but this was urgent and important so i apreciate your responce and hom,e it works after i try it i will happily award u your points


and yes i did mean quotes
0
 
ttnnkkrrAuthor Commented:
had to make a slight command line change
:: ----STRIPCHAR.BAT-----
@ECHO OFF
FOR /F "DELIMS=" %%F IN (PINGTEST.TXT) DO (
SET LINE=%%F
CALL :STRIP
)
GOTO END
:STRIP
ECHO LINE=%LINE:~1,-1%>>PINGTEST.BAT
:END
CALL PINGTEST.BAT
:: ----STRIPCHAR.BAT-----

to  
:: ----STRIPCHAR.BAT-----
@ECHO OFF
FOR /F "DELIMS=" %%F IN (PINGTEST.TXT) DO (
SET LINE=%%F
CALL :STRIP
)
GOTO END
:STRIP
ECHO %LINE:~1,-1%>>PINGTEST.BAT
:END
CALL PINGTEST.BAT
:: ----STRIPCHAR.BAT-----



but it otherwise works perfectly thanks so much
0
 
ttnnkkrrAuthor Commented:
thanks very much for the help
0
 
pbarretteCommented:
Hi ttnnkkrr,

I'm glad you got it working. Sorry about the "ECHO LINE=" bit. I guess my brain wasn't working correctly when I wrote it. From the timestamp on my post, it looks like I wrote it at 3:20am my time. What was I doing awake at that point? :)

pb
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now