The closest I could come in Batch is something like this:
for /R %i in (*.jpg) do move %f~i %p~i
But, that won’t work because %p~i is the full path name and not the name of the directory. 
Your best solution is to download and install Git. You aren’t interested in Git, but the Git BASH program that has a lot of basic Unix tools. The whole thing takes 3 minutes to download and install. You can do Cygwin, but that’s more than you need and the last time i installed that, it took 2 hours.
[ul]
[li] First: BACKUP THE DIRECTORY THAT CONTAINS ALL OF YOUR Pictures. You want to make sure you don’t do anything irreversible.[/li][li] Download Git. You can get it from Google Code Archive - Long-term storage for Google Code Project Hosting.. The first link is the one you want.[/li][li] After it downloads, Install it. Just take the defaults.[/li][li] There will be an Icon on your desktop for Git BASH. Open that up.[/li][li] Now, you’ll have to change to the directory that contains the pictures. You’re heart will feel some palpitations since you’ll be doing this from the command line, but this is fairly harmless. The command to change directories is cd – just two letters. The tricky part is that directory names in this shell are separated by forward slashes ( / ) – the one by the question mark, and not the backward slashes ( \ ) that are found above the Return key. Also, Drive letters are surrounded by slashes. The C: drive is /c/ and the D: drive is /d/. Also remember to put quotes around the name if there are spaces in the name.[/li]
The easiest way is to move one directory at a time. For example, if your pictures are under C:\Documents and Settings\Old Guy\Desktop\My Pictures, you’ll be executing this series of commands:
$ cd /c/
$ cd "Documents and Settings"
$ cd "Old Guy"
$ cd "Desktop"
$ cd "My Pictures"
You can use the “pwd” command to see your current directory and use the “ls -F” command to see all the directories and files in that directory.
Once you’re in the directory you want to be in, you’ll be typing in the following command in at the command line. The “>” are a continuation prompt, so you don’t type that in.
$ find . -type f | while read file
> do
> basename=$(basename "$file")
> dirname=$(dirname "$file")
> current=$(basename "$dirname")
> echo "moving file '$file' to '$dirname/${current}_${basename}'"
> mv "$file" "$dirname/${current}_${basename}"
> done
[/ul]
When you type in “done” the progrm will go through and rename all files in that directory from foo.jpg A_foo.jpg where “A” is the directory name.
I’ve tried this command myself, but you’ll have to realize I did it on my Mac in the BASH shell, so I can’t guarantee exactly how it’ll work.
I recommend to have a full bottle of Scotch at the ready. You can take a congratulatory swig if it works, or drown your sorrows in case this goes bad.
In fact, let’s wait to see if people can pick this apart for possible syntax errors.