You have at least two options to do this, you will need to figure out what works for you. You can either specify a "datadir" as a command-line argument like:
"C:\Program Files (x86)\Bitcoin\bitcoin-qt.exe" -datadir=d:\BitCoinData
Or in the bitcoin.conf file you can play with the variables
datadir and
choosedatadir (GUI dialog, let's you choose directory - I think).
More info:
Running Bitcoin and
Data Directory on the Bitcoin wiki.
You should probably read before you suggest something that your source contradicts. Datadir can not be set in the config file because the config file is within the directory given by datadir.
The configuration file is not automatically created; you can create it using your favorite plain-text editor. By default, Bitcoin (or bitcoind) will look for a file named 'bitcoin.conf' in the bitcoin data directory, but both the data directory and the configuration file path may be changed using the -datadir and -conf command-line arguments.