This thesis deals with dynamic optimization of batch processes, i.e. processes that are characterized by a finite time of operation and the frequent repetition of batches. The objective is to maximize the quantity of the desired product at final time while satisfying constraints during the batch (path constraints) and at final time (terminal constraints). The classical approach is to apply, in an open-loop fashion, input profiles that have been determined off-line using optimization. In practical applications, however, a conservative stand has to be taken since uncertainty is present, which may lead to constraint violations or non-optimal operation. Measurement-based optimization helps reduce this conservatism by using measurements to compensate for the effect of uncertainty. In order to achieve optimal operation, it has been proposed to track the necessary conditions of optimality (NCO). For the terminal cost optimization of batch processes, the NCO consist in four parts : Path constraints and path sensitivity conditions that have to be met during the batch, as well as terminal constraints and terminal sensitivity conditions that have to be met at final time. The intuitive approach is to handle the path conditions during the batch by using on-line measurements, and to implement the terminal conditions on a run-to-run basis since measurements of the terminal conditions are available off-line. However, run-to-run adaptation methods have two important disadvantages : i) Several runs are necessary to obtain optimal operation, and ii) within-run perturbations cannot be compensated. In this thesis, it is shown via a variational analysis of the NCO that meeting the constraint parts of the NCO is more important than meeting the sensitivity parts. Therefore, methods for steering the system toward the terminal constraints by using on-line measurements are examined in order to give priority to meeting the constraint-seeking conditions. This work proposes to track run-time references that lead to the constraints at final time. Thus, a two-time-scale methodology is proposed, where the task of meeting the active terminal constraints is addressed on-line using trajectory tracking, whilst pushing the sensitivities to zero is implemented on a run-to-run basis. Moreover, the use of Iterative Learning Control (ILC) to improve tracking is studied. Reference tracking is often accomplished with linear controllers of the PID type since they are widely accepted in industry and easy to implement. However, as batch processes operate over a wide region and are often highly nonlinear systems, tracking errors are inevitable. A possibility to reduce tracking errors is to use time-varying feedforward inputs. The feedforward inputs can be generated by using a process model, but the presence of model uncertainty can limit the performance. Instead of a process model, ILC uses error information from previous batches for computing the feedforward inputs iteratively. Since batch processes are often not reset to identical initial conditions, ILC schemes that provide a certain robustness to errors in initial conditions must be used, such as ILC with forgetting factor. In this work, a scheme that shifts the input of the previous run backward in time is proposed. The advantage of the input shift over the use of a forgetting factor is that, when the reference trajectory is constant and the system stable, the tracking error decreases with run time. In addition to a shift of the input, a shift of the error trajectory, which is known as anticipatory ILC, is also used. The foregoing methodological developments are illustrated by two case studies, a simulated semi-batch reactor and an experimental laboratory-scale batch distillation column. It is shown that meeting the terminal constraints is the most important optimality condition for the processes under study. Provided that selected composition measurements are available on-line, these measurements are used to steer the processes to the desired terminal constraints on product composition. In comparison to run-to-run optimization schemes, performance is improved from the first batch on, and within-run perturbations can be rejected.