A guide box for a rail loading and unloading machine. The guide box guides a rail from a ground location toward a drive unit and can be provided with actuators to enable steering of the rail. The guide box includes a base roller that underlies a rail path through the guide box. An arm extends upwardly along each side of the rail path and carries a guide roller. The arms are pivotable toward one another to abut the guide rollers over the rail path and thereby capture the rail between the guide rollers and the base roller or away from one another to enable insertion of a rail therebetween. The guide rollers are vertically pivotable to enable obstructions on the rail to pass through the guide box.