?
Solved

batch commands extracted automatically from txt file

Posted on 2003-02-22
5
Medium Priority
?
345 Views
Last Modified: 2006-11-17
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
Comment
Question by:ttnnkkrr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
pbarrette earned 800 total points
ID: 8002241
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
 

Author Comment

by:ttnnkkrr
ID: 8037171
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
 

Author Comment

by:ttnnkkrr
ID: 8054047
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
 

Author Comment

by:ttnnkkrr
ID: 8054053
thanks very much for the help
0
 
LVL 10

Expert Comment

by:pbarrette
ID: 8055173
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question