Hi I'm trying to program the atmega328p with avrdude in windows

Hello I'm trying to program the atmega328 with avrdude using arduino duemilanove board with the following command:

avrdude -v -v -v -v -v -v -c avrispmkII -p ATMEGA328P -P COM4 -b 115200 -C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -U flash:w:battery.hex

and this is the following output:

avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf"

         Using Port                    : COM4
         Using Programmer              : avrispmkII
         Overriding Baud Rate          : 115200
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
...

it seems that's starting to send the code, I even see the leds RX Blink really fast, but then it stops....

can you help me program this hex file into my arduino?

Thank you very much.

PS: I'm doing that to program in pure C as shown here. I can program the arduino normally through the arduino's IDE, with the same configuration.

Change avrispmkii for avrisp.
Are you using duemilanove as isp programmer?

Thank you mart for the quick reply. Yes, I'm using duemilanove as ISP. avrisp also works in the arduino's IDE but still doesn't with avrdude, here it's the output:

C:\...\>avrdude -v -v -v -v -v -v -c avrisp -p ATMEGA328P -P COM4 -C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -U flash:w:battery.hex

avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf"

         Using Port                    : COM4
         Using Programmer              : avrisp
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x03
avrdude: Send: 0 [30]   [20]
...

In Arduino IDE, go into Preferences and check the option Show verbose output during upload.
Then upload any sketch, perhaps blink, to the Arduino.
The exact command used to program the Arduino shows up in the console at the bottom of the window.
Copy that command to the command line, and change just the full path to the hex file you want to upload.

Thank you very much dmjlambert. I was wondering if I could do that, I even opened the preferences windows but I didn't see.

final code:

avrdude -C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -v -p ATMEGA328P -c arduino -P COM4 -b 57600 -U flash:w:battery.hex:i

The baud was wrong and the programmer must be arduino (in my case).