Delete files from one folder if a similarly named file does not exist in another folder

Solution 1:

You can do this directly from command line:
for %F in ("A\*.gif") do @if not exist "B\%~nF.jpg" echo del "%F"
Above example simply prints the commands so you can verify it will does what you want. After you're sure it's ok remove echo and it will actually run delete.
You may of course put this in a batch, if you wish so replace % with %% and remove @ (and probably add @echo off instead)