If your HC-05 board has a red button, I've found that it has two purposes:
1.) Press it while powering the board on will put the module into "AT" mode;
2.) Press it while the board is in normal mode and you can enter "AT" commands, e.g. in a script.
Note that what I also found with my board is that even though I'm in "AT" mode, certain commands won't get a response (AT+NAME?, e.g.) but if I press the red button the command gives the correct response. So, if you're in "AT" mode and you don't get a response to a command, try pushing the red button. I don't know if it's connected to a pin or not; but on my board I only have 6 pins( vcc, gnd, tx, rx, en, state) so it wouldn't matter to me if there was a pin associated with it or not. Maybe if someone has a breakout board you might have access to the pin associated with the red button and could programmatically ("press") it.
Just a FYI tidbit