In order to deal with the I/O constraints in a practical plant, a soft limiter is often added into the control design procedure directly; however, the performance of the soft limiter based control approach will be degraded greatly due to the use of the soft constraints. This paper proposes a datadriven optimal terminal iterative learning control (constraint-DDOTILC) approach for the end product quality control of batch processes with I/O hard constraints. To deal with nonlinearities, a novel iterative dynamic linearization method without omitting any information of the original plant is introduced such that the derived linearized data-driven model is completely equivalent to the original nonlinear system. By transferring all the constraints on the system output, control input, and the change rate of input signals into a linear inequality, a novel constraint-DDOTILC is developed by minimizing an objective function under the derived linear matrix inequality constraint. The optimal learning gain of the constraint-DDOTILC can be updated iteratively according to the input and output measurements to enhance the flexibility for modifications and expansions of the controlled plant. Both theoretical analysis and simulation results confirm the effectiveness of the proposed constraint-DDOTILC.