Home / Microsoft / Microsoft DOS / batch file for reading and coping strings within lines
0 Members and 3 Guests are viewing this topic. « previous next »
Pages: 1 [2]  All - (Bottom) Print
Author Topic: batch file for reading and coping strings within lines  (Read 651 times)
Mat51
Topic Starter
Rookie



Posts: 18

Experience: Beginner
OS: Unknown

« Reply #15 on: December 29, 2011, 08:52:36 AM »

Hi Raven,

I can get the cumulative cost to work now, its just to get the code to work for more than one text file in the subdirectory. at the moment its making search on one text file.

Thank you :)

Matilda
IP logged
Raven19528
Hopeful



Thanked: 29
Posts: 284

Computer: Specs
Experience: Experienced
OS: Windows 7



« Reply #16 on: December 29, 2011, 10:28:46 AM »

With the spaces being a pain like they are, it might be fruitful to add spaces as delimiters and then adjust the code to fit. It's not a huge change, but it's up to you if you want to see how that will work. The code should be pulling all text files as is, but if it isn't working like that, you can use the following in the first for line:

Code: [Select]
for /r "delims=" %%A in ("c:\Reservoir Management\script\*.txt") do (

This will hit all .txt files within that parent folder. Alternatively, you could use the following:

Code: [Select]
cd /d "c:\Reservoir Management\scripts"
for /f "delims=" %%A in ('dir /s /b *.txt') do (

You can use the /S switch on the DIR command to get all of the subdirectories within the folder, similar to using the /R switch above, or leave it off to get only the files within the folder you are currently in, without subdirectories.
IP logged

"All things that are
Are with more spirit chased than enjoy'd" -Shakespeare
Mat51
Topic Starter
Rookie



Posts: 18

Experience: Beginner
OS: Unknown

« Reply #17 on: December 29, 2011, 11:38:32 AM »

Raven,

Thanks....... this thread has answered my query.....

Many Thanks to Raven :)
IP logged
Mat51
Topic Starter
Rookie



Posts: 18

Experience: Beginner
OS: Unknown

« Reply #18 on: December 29, 2011, 11:41:36 AM »

Raven,

There is a new thread, I have just posted  prefix file names by Mat51.

if you could help me please.......

Matilda
IP logged
Pages: 1 [2]  All - (Top) Print 
Home / Microsoft / Microsoft DOS / batch file for reading and coping strings within lines « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.104 seconds with 19 queries.