I know this section is pretty well dead, with even the more active members remaining almost exclusively on Discord. However because I don't trust discord enough to actually use it, I'll post this here.
My question is would it be advisable to consider moving to Python from Batch for general utility scripting (in the sense of automating simple command-line mathematical or file operations). The reason I'm asking the opinion of others, and more over posting this here rather than in the Python section, is because obviously there will be more people well-experienced with Batch who can give a bit more detailed insight as to why or why not.
This topic came to mind a few weeks ago when I decided to completely reformat all of my music library from the same old 41k MP3 I've been using for years. I began considering it after reading about the witchcraft benefits of the OPUS format. (Essentially you retain a considerable amount of quality even at very low bitrates.) Now, I'm not all too familiar with the technical aspects of how Batch goes. I've enough experience with it over the years to the point where I can look up something I need to do and not have much if any issue instating whatever it may be into my script. However upon beginning the script for automating the entire downloading and conversion process in one script, I came across an issue with tokenizing the file name in order to specify the artist and title individually (for use in metadata).
FFMpeg allows for full access to metadata tagging via command line. That was perfect as I just wanted to run a single script and have everything be done. However the specific issue I had was with splitting the file name and removing the extension. (I've since completed the script in Python and deleted the old Batch script, so I'll do my best to recall exactly what went on.) I used the string manipulation functions in an attempt to split/remove what was needed. Specifically, I just needed to tokenize two elements between a string, that being " - " (a space followed by a hyphen, then an additional space). After experimentation, it appears as if Batch's string manipulation function does not allow for splitting by a string, only by an individual character. Correct me if I've misinformed myself. I read up on Robvanderwoude's archive which I've used for years but I may very well have mistaken or misread something.
At that point, I searched for a Batch Regex script. Turns out, there's JREPL. (If you've some need to Regex string replacement in Batch, it's a fantastic little tool.) I imported it and began using it, however for whatever reason (yes, I used the correct Regex formatting for what I needed) it would not allow for individual tokenizing of each element into separate variables. For example, I ran "Nickelback - Photograph.webm" as the input file, and it split between the " - " like it should. But for whatever reason it included the " - " in the initial token. Therefore the artist was set as "Nickelback - " and the title was (as proper after removing the last four characters with string manip) "Photograph". Perhaps I was a bit lazy and frustrated at the same time, in addition to knowing damn well that it would be so much easier in Python. However because I'm stubborn, I kept at it but to no avail. After two or so hours of tinkering around, I caved and began the same script in Python. Low and behold the Python version (up to this point) has taken only a mere three hours.
Granted, I understand that everyone has their own preferred language and way of doing things in said language. However for the longest time I have been forcing myself to use Batch for (presentably) such simple operations. Maybe I just went about it in an inefficient manner, I don't know. But Python came so much easier (as I am used to C and C++, which Python offers capability similar to arrays). That's what I'm asking. What do you think? Is Python better overall for general utility programming? It's not system-native, but performance is not of my concern for some generic automation script. I mean, it offers system shell executing from within Python without the need for external scripts like many other languages. Additionally, it has a much wider variety of external libraries. I feel like this is sounding more of a sales pitch for Python, but I don't mean it to come off that way. I'm curious as to what you guys here have to say about the comparisons. I, myself, am almost completely set on moving to just Python with little to no Batch (unless, of course, it's something trivial where Python provides no better solution). Thoughts?
Also, this isn't in the Python section, but I can recreate the incomplete Batch script and additionally post the complete Python script for comparison. Actually... I'll see if I can actually complete the script in just Batch again. I'm a glutton for punishment, I guess.
My question is would it be advisable to consider moving to Python from Batch for general utility scripting (in the sense of automating simple command-line mathematical or file operations). The reason I'm asking the opinion of others, and more over posting this here rather than in the Python section, is because obviously there will be more people well-experienced with Batch who can give a bit more detailed insight as to why or why not.
This topic came to mind a few weeks ago when I decided to completely reformat all of my music library from the same old 41k MP3 I've been using for years. I began considering it after reading about the witchcraft benefits of the OPUS format. (Essentially you retain a considerable amount of quality even at very low bitrates.) Now, I'm not all too familiar with the technical aspects of how Batch goes. I've enough experience with it over the years to the point where I can look up something I need to do and not have much if any issue instating whatever it may be into my script. However upon beginning the script for automating the entire downloading and conversion process in one script, I came across an issue with tokenizing the file name in order to specify the artist and title individually (for use in metadata).
FFMpeg allows for full access to metadata tagging via command line. That was perfect as I just wanted to run a single script and have everything be done. However the specific issue I had was with splitting the file name and removing the extension. (I've since completed the script in Python and deleted the old Batch script, so I'll do my best to recall exactly what went on.) I used the string manipulation functions in an attempt to split/remove what was needed. Specifically, I just needed to tokenize two elements between a string, that being " - " (a space followed by a hyphen, then an additional space). After experimentation, it appears as if Batch's string manipulation function does not allow for splitting by a string, only by an individual character. Correct me if I've misinformed myself. I read up on Robvanderwoude's archive which I've used for years but I may very well have mistaken or misread something.
At that point, I searched for a Batch Regex script. Turns out, there's JREPL. (If you've some need to Regex string replacement in Batch, it's a fantastic little tool.) I imported it and began using it, however for whatever reason (yes, I used the correct Regex formatting for what I needed) it would not allow for individual tokenizing of each element into separate variables. For example, I ran "Nickelback - Photograph.webm" as the input file, and it split between the " - " like it should. But for whatever reason it included the " - " in the initial token. Therefore the artist was set as "Nickelback - " and the title was (as proper after removing the last four characters with string manip) "Photograph". Perhaps I was a bit lazy and frustrated at the same time, in addition to knowing damn well that it would be so much easier in Python. However because I'm stubborn, I kept at it but to no avail. After two or so hours of tinkering around, I caved and began the same script in Python. Low and behold the Python version (up to this point) has taken only a mere three hours.
Granted, I understand that everyone has their own preferred language and way of doing things in said language. However for the longest time I have been forcing myself to use Batch for (presentably) such simple operations. Maybe I just went about it in an inefficient manner, I don't know. But Python came so much easier (as I am used to C and C++, which Python offers capability similar to arrays). That's what I'm asking. What do you think? Is Python better overall for general utility programming? It's not system-native, but performance is not of my concern for some generic automation script. I mean, it offers system shell executing from within Python without the need for external scripts like many other languages. Additionally, it has a much wider variety of external libraries. I feel like this is sounding more of a sales pitch for Python, but I don't mean it to come off that way. I'm curious as to what you guys here have to say about the comparisons. I, myself, am almost completely set on moving to just Python with little to no Batch (unless, of course, it's something trivial where Python provides no better solution). Thoughts?
Also, this isn't in the Python section, but I can recreate the incomplete Batch script and additionally post the complete Python script for comparison. Actually... I'll see if I can actually complete the script in just Batch again. I'm a glutton for punishment, I guess.


![[Image: chain.png]](https://i.postimg.cc/NFnfH9zY/chain.png)
