| 1. |
Solve : Parse two string lists? |
|
Answer» Hi there, How are you passing the 4 parameters?Look at his post. The parameters have to be done as literal items, on the command line. With quotation makes, with commas. Exactly as he posted. This is a candidate for a shell script or a VBS or something more that just pure batch commands. BTW, Nothing was said about error recovery. If he has more than a four or five servers, it is going to be a mess when an error happens. And the do happen. Quote from: Geek-9pm on December 01, 2009, 03:59:36 PM Look at his post. That was what I was hoping. Incidentally "he" signs "his" post "Natalia", so I think I may have read it a BIT more carefully than you did Thank your for your solution, Salmon. :-) Let me give it a try. To answer your question, the 4 parameters are being passed from an executable that invokes the script as command line argument to the script. (%1, %2, %3, %4, %0 is reserved to indicate the test mode operation.) To answer Geek-9pm's concern about error handling, it was omitted intentionally in order to clearly state the problem space. The error handling does exist in the script. :-) Thanks, Natalia LOL, on the "his" comment. Got me laughing :-)I am reminded of the old story about the Englishman travelling in Ireland who is unsure how to get to a certain town. He asks an elderly LOCAL who says "Ah sure, begorrah, if I wanted to get to there, I wouldn't be startin' from here!". Natalia, if you look through this forum, you will see many threads in which somebody asks for a batch solution to a problem. An answer is given, but also people jump in saying "Don't bother with batch, use Visual Basic Script/Perl/Python/Awk/GNU grep/sed, (or whatever)", because those methods are somehow "better" or more "elegant" or "efficient". This may be so, but I think what sometimes escapes these code warriors is that in many cases the person asking the question is not requesting a code snippet that SOLVES a problem, text-book fashion, or a lesson in some other scripting language, but rather a solution is desired to enable them to finish a larger batch script that they have already spent some time and effort writing. Often other solutions are impossible because of restrictions on third party installations and/or use of VBScript. OK the sermon is over. Natalia, I notice that in your comma separated lists, that "DisplayName N" is quoted, but ServiceN is not. I removed the quotes from DisplayName, and put them back again, because of a problem I had (XP SP3) with a strange error message to do with oddly named files not being found if the variable was used with quotes as the dataset in a FOR command. |
|