Problem with adafruit motor shield

I recently made an IR remote controlled robot. The problem is that the the robot only works when I connect the arduino to the computer. I've used 4AA batteries as external power for the motor shield. Please tell me why this happens how to rectify this!

You need to be clearer with your description.

Do you mean that it works when the Arduino is connected to the PC with the USB cable AND the motors are powered with 4xAA batteries.

If so, a first guess is that when you disconnect the USB cable there is no power going to the Arduino. You could check that by measuring the voltage at the Arduino 5v pin with your multimeter.

Are the batteries new or fully charged?