Computing.Net > Forums > Programming > help with Batch file to change .txt

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

help with Batch file to change .txt

Reply to Message Icon

Name: Sany
Date: September 7, 2006 at 15:41:34 Pacific
OS: Windows XP Pro sp2
CPU/Ram: xeon 2.8/3gb
Product: Precision
Comment:

Hi,

So far I have a batch file that creates a set of nested folders within a specified folder. So far so good. Then I want to create a file by using information in a text file, amending it and writing a new .txt file into one of the just created folders.
this is how I got the folders created:

@echo off
set /p Project="name"
md %1\%Project%
md %1\%Project%\folder_1 %1\%Project%\Folder_2 %1\%Project%\Folder_3

now for the part I can't quite get:

the information in the text file I wish to use and amend to write the text file appears as follows:

(the number of names within the [] will always stay the same but the number of entries under each will change but it will always start Dir1=, Dir2=, Dir3=, Dir4= on and on until the last entry is reached and it starts again for the new [] heading.

[Directories]
blah="path"
blah="path"
blah="path"
[Objects]
Dir1="path"
Dir2="path"
Dir3="path"
[Maps]
Dir1="path"
Dir2="path"
Dir3="path"
Dir4="path"
Dir5="path"
Dir6="path"

the file I want to create should have all of the above as it is in the first text file but then add two lines.

the first should always be under the last Dir entry under [Objects] and should start Dir#="path"
where # is the number after the one from the line above it (i.e if the line above starts Dir26=... then this line should start Dir27= and then the path to Folder_1 created earlier.

the second is the same as above but should be entered below the last entry in the [Maps] portion of the text.

I hope this is clear let me know if not.

thanks

Sany



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: help with Batch file to change .txt

Batch file to change some text. www.computing.net/answers/programming/batch-file-to-change-some-text/18769.html

Batch File to Change Database .ini www.computing.net/answers/programming/batch-file-to-change-database-ini/14429.html

Need Help With Batch Script www.computing.net/answers/programming/need-help-with-batch-script/9053.html