Yes you can add computer to domain from dommand prompt. I don't know why you need a script for this. Anyway....
Assume MYDOMAIN is the name of the domain and
MYCOMPUTER is the name of the workstation or stand-alone server that is joining
the domain.
NETDOM lets you join a domain from the command line. This can apply to Windows NT
workstations and standalone servers.
If you are the administrator of the domain
------------------------------------------
If you have administrative access to the primary domain controller (PDC) (such as
through an user account member of the Local Administrators or Domain
Administrators groups,) NETDOM automatically creates the computer account if
necessary.
You may run the following command (in a single line):
NETDOM /Domain:MYDOMAIN /user:adminuser /password:apassword MEMBER
MYCOMPUTER /JOINDOMAIN
The command line above may be run on any computer as soon as you have
administrative access to the computer MYCOMPUTER. If you are already