Batch file help

I am creating a batch file to loop through the URL links on a users desktop and delete specific ones. Everything is working fine except for the if conditions in my loop. I thought maybe I had to add an escape character for the = sign for strOldurl and strNewurl but even putting in ^=PRD didn't seem to help.

What I want is to write the path to strOldPath and strNewPath so that I can delete them. When I debug by adding echo statements I can see that strOldPath and strNewPath have no value

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

See if this gets you any closer, noticed a few problems and tried to address them. When doing the SET statements, there can't be any spaces before or after the equals sign. Also, stay away from including quotes around the variable strings, DOS doesn't strip those out the way you think when doing the SET, so they end up part of the variable. Also, you weren't using %variable% syntax when trying to get the value of a variable. Missing EXIT statements at the end of main code, and at the end of subroutine.

Since all you seem to want to do is delete URLs containing some matches, this should work; it's in test mode and will only echo out the "del" and "copy" commands it would normally run. Remove the uppercase ECHOs in lines 9 and 16 to run it for real.

Note that this script has two major errors:
1. It will delete a maximum of one URL file with strOldUrl in it, and a maximum of one URL file with strNewUrl in it. If two or more of either type are present, the first ones found will be left.
2. If not both strOldUrl and strNewUrl are found in URL files, the script will try to delete everything in the current folder, because there will be a 'del ""' statement.