Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

More file-renaming problems involving commas...

Just a bit of background to orient anybody who might not have seen previously postings:

I regularly get files from an external website (that I have no control over whatsoever) that have underscores in their names rather than blanks. Since I really hate underscores in my file names (strictly for cosmetic reasons, I will be the first to admit :eek:), I have been trying to write a batch file to rename these files to a format that is more pleasing (to my eyes)! (For too long a time, I might add!) The file names also may have both open and close parenthesis as well as commas (all of which I rather like!). There has been a sequence of interchanges with folks on this website on this matter in the past, all of which have resolved the matter to a given point. This is, I think, the last entry in the sequence, and I am reporting it here primarily because I think it's a bug. (It does have a not-too-bad workaround.) So, here goes. Starting with a (fairly?) simple batch file that shows the bug (I'm attaching it because it's a little lengthy), everything works correctly other than the final conversion back to commas. (To make everything work in other processes, I start out by changing commas in the file names to pound signs ("#"), and when I'm all done I want to change the pound signs back to commas.) The "bug" (if that's what it is) can be stated rather simply: If I use the "@replace" function directly to change these pound signs back to commas, everything works correctly, but if I "wrap" the "@replace" function in an otherwise user-defined function that also has functions that do the other conversions I want in it, it fails miserably (the output is not at all what I would expect/hope for!). Since the @replace works fine when it is called directly and fails (miserably?) when it is embedded in a user-written function, I tend, again, to think this is a (weird?) bug. (The work-around is to call the @replace function directly rather than wrapping it in a function with invocations of other functions in it.) Just in case somebody's interested!
 

Attachments

  • Demo.bat
    1.1 KB · Views: 277

Similar threads

Back
Top