Courts having jurisdiction of children shall have power to commit children to the school who are receivable therein as set forth in section forty-eight hundred seven. Commitments by such courts shall be in accordance with the provisions of the penal law and code of criminal procedure applicable thereto. The commitment shall not be for any fixed period of detention. Such detention shall be conducted with a view to the improvement and to the restoration, as soon as practicable, of the child so committed to its home, if after due investigation such home is found to be satisfactory. The provisions of section four hundred eighty-six of the penal law as to commitments to institutions shall apply fully to commitments to the school.