Insert text from xml tag into text file

April 2, 2012 at 08:48:24
Specs: Windows 7
Hello. I am in need of some help please,
I have changed my mind at the last second as to how I would like to see this certain batch executed. Not through xml but by folder structure sorry.
I am looking for a batch file that would list the names of folders in my movie database, and then insert their names in a text document in this fashion:

;;Media Browser Movie Search
Command=Batman Begins
Response=“Batman Begins”
Action=SendKeys “Batman Begins”

Where Batman Begins is an example of one of my movie folders I have in my "Movies" folder.
Thank you in advance. I've been everywhere online trying to figure it out with little to no experiance in this field.

See More: Insert text from xml tag into text file

Report •

April 10, 2012 at 23:19:26
first little bit is just some links to go to learn batch (very good sites and pages)
skip that if you want, further on is the answer i hope
the best one yet, the site you are on right now:
a site with all the commands for a multiple p languages:
and some tips and tricks pages: more clever tips and tricks

now on ss64 do a quick search for "for" and "dir" (yes i know dir right, it is so much more complex than you'd think) there are a couple types of for and you werent to clear what you wanted but if the info is listed clearly in a text file (just the filename on the line) then you can do this

1. @Echo Off
2. SetLocal EnableDelayedExpansion
3. ::This line is just in case n has been defined before the batch file is run
4. Set n=
5. Set _InputFile=c:\test1\config.txt
6. For /F "tokens=*" %%I IN (%_InputFile%) DO (
7. Set /a n+=1
8. Set _var!n!=%%I
9. )
10. :: This line will display the variables just assigned
11. :: For testing only, delete when not needed
12. Set _
13. EndLocal

the numbers are there because the formating will wreck the line numbers

or if it has like 3 different things on one line (but the third is what you want (you can change it i think(the delims are :'s))) then this next one will do that (i cant help you in changing anything because i dont know what you want just try and work it out it is pretty self explanatory)

1. @Echo Off
2. Set _InputFile=c:\test1\config.txt
3. For /F "tokens=1,2* delims=:" %%A IN (%_InputFile%) DO Set _Data%%A=%%C
4. :: This line will display the variables just assigned
5. :: For testing only, delete when not needed
6. Set _
7. EndLocal

Report •
Related Solutions

Ask Question