Theoretical studies and analytical scalings were carried out to find the optimized laser parameters and target conditions so that ultrashort hard x-ray pulses and high x-ray power could be achieved. The dependence of laser intensity and wavelength on the yield of K-shell x-ray emission was studied. We propose an optimal design for a foil target for producing high-yield hard x-ray pulses of customizing duration.