I know my way around batch files, and have dipped my toes in VBScript about 10 years ago. Can any of these two play around with XML files, or do I need to learn another language? Batch files are limited due to the usual problems with special characters like !,%,etc and no native support for XML, and I don't know if VBScript even supports XML. Basically what I want to do is parse a XML file and apply some "conditions" to remove similar entries which are not exactly the same name, but repeated nonetheless. The "conditions" will determine which one stays and which ones are deleted. For example, if I want to keep all entries with "(abc)", then "text (abc)" stays and "text (def)" is deleted.
I wouldn't recommend using batch for parsing XML data. Use a language (like powershell, for instance) that natively supports such data formats... Here's a good start: https://devblogs.microsoft.com/scri...fe-learns-to-use-powershell-to-work-with-xml/ In PS (if I simplify to the extrem) you can do something like this... Code: [xml]$XML_File = Get-Content "path\to\yourfile.xml" $XML_File.container1.container2 | % { $1st_valuetoparse = $_.1st_valuetoparse $2nd_valuetoparse = $_.2nd_valuetoparse If ($1st_valuetoparse -eq "abcdef") {$1st_valuetoparse = "abc"} If ( ($2nd_valuetoparse -eq "abcdef" -or ($2nd_valuetoparse -like "*def*") ) {$2nd_valuetoparse = "abc"} $Object = [pscustomobject][ordered]@{ "1stvaluetoparse" = "$1st_valuetoparse " "2nd_valuetoparse" = "$2nd_valuetoparse" } $Object | Export-Csv "$PSScriptRoot\parsedfile.csv" -delimiter "`t" -NoTypeInformation -Append } Set "container(s)" and "valuetoparse" according to your xml of course, that's just very basic example to get you started... Might be better if you give an example of your xml file and what to keep in scripting subforum if you need more precise help.
I thought about using Powershell, but I already tried learning it once or twice and found it too confusing. Maybe I'm not as young as I once was and learning a new language at this point is just too time consuming for me. I googled a bit about VBScript and XML and it seems it can also parse XMLs, probably not as "simple" as with PowerShell but since I already used VBScript before it would be easier for me to "relearn". I just don't if it has the same limitations as Batches do when dealing with variables containing parenthesis, "%" and "!", as some strings I want to compare have them.
I've been taking a look at several VBScript code snippets and it seems pretty "basic" to do (pun intended), I can already read the lines I wanted to read, it's now just a question of breaking them into parts using delimiters, then compare using some conditions and delete what's unwanted. I prefer it because I only need a text editor and I can run it by double clicking it. It's just for personal use so I guess it will do. Maybe next time I should do a little research before posting useless questions