To do this directly in the registry you can add a String Value to:
HKLM\SOFTWARE\Microsoft\ODBC\ODBC.INI\ODBC Data Sources
to add a System DSN, or:
HKCU\Software\ODBC\ODBC.INI\ODBC Data Sources
to add a User DSN.
The Name of the Value is the name of the Data Source you want to create and the Data must be 'SQL Server'.
At the same level as 'ODBC Data Sources' in the Registry create a Key with the name of the Data Source you want to create.
This key needs the following String Values:
Database - Name of default database to which to connect
Description - A description of the Data Source
Driver - C:\WINDOWS\system32\SQLSRV32.dll
LastUser - Name of a database user (e.g. sa)
Server - Hostname of machine on which database resides
For example, using the reg.exe application from the command line to add a User Data Source called 'ExampleDSN':
reg add "HKCU\Software\ODBC\ODBC.INI\ODBC Data Sources"
/v ExampleDSN /t REG_SZ /d "SQL Server"
reg add HKCU\Software\ODBC\ExampleDSN
/v Database /t REG_SZ /d ExampleDSN
reg add HKCU\Software\ODBC\ExampleDSN
/v Description /t REG_SZ /d "An Example Data Source"
reg add HKCU\Software\ODBC\ExampleDSN
/v Driver /t REG_SZ /d "C:\WINDOWS\system32\SQLSRV32.DLL"
reg add HKCU\Software\ODBC\ExampleDSN
/v LastUser /t REG_SZ /d sa
reg add HKCU\Software\ODBC\ExampleDSN
/v Server /t REG_SZ /d localhost