We present a novel procedure for manipulating the near-field of plasmonic nanoantennas using neural network-controlled laser pulseshaping. As model systems we numerically studied the spatial distribution of the second harmonic response of L-shaped nanoantennas illuminated by broadband laser pulses. We first show that a trained neural network can be used to predict the relative intensity of the second-harmonic hotspots of the nanoantenna for a given spectral phase and that it can be employed to deterministically switch individual hotspots on and off on sub-diffraction length scale by shaping the spectral phase of the laser pulse. We then demonstrate that a neural network trained on a 90 nm × 150 nm nano-L can in addition efficiently predict the hotspot intensities in an antenna with different aspect ratio after minimal further training for varying spectral phases. These results could lead to novel applications of machine-learning and optical control to nanoantennas and nanophotonics components.