| 1. |
Solve : A problem that's too long to explain in this title? |
|
Answer» As the title states, my BATCH problem is too long to simply write in the title. I have tried everything and I can't figure out how to do this. So, here's my problem: As the title states, my batch problem is too long to simply write in the title. I have tried everything and I can't figure out how to do this. So, here's my problem: EH, this is quite complicated, Batch files need specific dirrections and information to perform opperations, Just out of pure currosity and to help with this investigation, what exactly is your batch file destined to do? As in its purpose.after reading your essay, i still don't understand what you are trying to do. Give examples and show your final output.Quote from: BatchFileCommand on August 13, 2009, 10:12:55 PM here's what I would like to do: take a random string like 1_3_5_7_9 and see how many matching numbers the two strings contain. You want to examine each filename and see if it contains one or more of (for example) 1, 3, 5, 7 or 9? something like this need delayed expansion for blah blah blah %%F in ('dir /b') do set filename=%%F for /f "tokens=1-5 delims=_" %%A in ("!filename!") do ( echo !filename! | find "%%A" && echo found %%A echo !filename! | find "%%B" && echo found %%B etc ) ) IF YOU WANT A BETTER DESCRIPTIONG OF WHAT I WANT TO DO SKIP THE FIRST SECTION! I figured out how to do it! 1, set both strings to variables like %1% and %2%. and do the following: %1:~0,2% I would set that to a variable like %n1% which stands for number 1. do the same thing again : set n2=%1:~2,4% then repeat the process for the other 3 numbers and the second string! Then using lots of if commands (MAYBE for loops) I would simply see how many numbers match! _______________________________________ ___________________________________ Okay, so this is what I wanted to do take 2 strings like 1_4_9_2_5 and 5_9_7_5_4 and see how many numbers matched between the two of them. in this case it would be 3. |
|