Are you using SQL 2000?.

If yes then you could generate the script from Enterprise Manager when you create scripts for tables. All FK script are created after create tables so you can easily get that from the script file generated.

If you want the fun way then you can use SQL DMO table object's script method.