This paper presents a new measurement-based optimization framework for batch processes, whereby optimal operation is achieved via the tracking of active constraints. It is shown that, under mild assumptions and to a first-order approximation, tracking the necessary conditions of optimality is equivalent to tracking active constraints (both during the batch and at the end of the batch). Thus, the optimal input trajectories can be adjusted using measurements without the use of a model of the process. When only batchend measurements are available, the proposed method leads itself to an efficient batch-to-batch optimization scheme. The approach is illustrated via the simulation of a semi-batch reactor under uncertainty.