At first glance, I thought running the data loader through the command line would be complicated. Turns out it is actually quite easy. Essentially all you need to do is create the configuration through the UI and then blast away at the command line:
- Create a new folder describing the job; I recommend creating the folder in “C:\Program Files\salesforce.com\Apex Data Loader 12.0\”. Place your csv file for the job (if required) into this directory.
- Start the Data Loader through the UI. Create and save your field mapping into the above directory. Configure the action precisely how you want it run in the future from the command line. Run it (use a 1 record test). Close the Data Loader.
- Copy the “config.properties” file from
Vista: “C:\Users\%username%\AppData\Roaming\salesforce.com\Apex Data Loader 12.0\”
XP: “C:\Documents and Settings\%username%\Application Data\salesforce.com\Apex Data Loader 12.0\”
to the folder that you created in step #1. - Open a command prompt to “C:\Program Files\salesforce.com\Apex Data Loader 12.0\bin\”. To run the batch type “process.bat ..\foldername”. You should see something like this:
A few notes:
- I am using version 12; this technique may not work with other versions.
- You can use an XML configuration, which allows for greater flexibility. Here are a few resources if you’d like to go this route:
Using the Data Loader from the Command Line
Data Loader Manual - To run the Data Loader on a schedule you’ll need to use a 3rd party application such as windows task scheduler.
- Sandbox Orgs through the Data Loader: change server host to https://cs#.salesforce.com, and make sure to append .sandboxname to the end of your username.
- When scripting this through a batch file you can append the output to a log file by using output redirection (e.g. “process.bat ..\foldername >> logfile.log”).
[via Force.com Blog, Dev 401 Training Applications Module 3]



jon cline
// Aug 20, 2009 at 12:39 am
John, point #4:
Sandbox Orgs through the Data Loader: change server host to https://cs#.salesforce.com, and make sure to append .sandboxname to the end of your username.
Can’t you use https://test.salesforce.com for this value as well?
thx.
jc
jon cline
// Aug 20, 2009 at 12:39 am
now subscribing…
frasuy
// Aug 20, 2009 at 4:16 am
Is the length of time for a job to complete reduced when kicking off the job from the command line vs. the UI?
I recently began using Informatica’s free data loader. Give that a shot if you are exploring new tools. It’s pretty slick and comprehensive.
jeffdonthemic
// Aug 20, 2009 at 8:51 am
Very nice!!
ForceCertified.com
// Aug 20, 2009 at 12:37 pm
@Jon Cline: Yes it looks like test.salesforce.com does work, thanks for the tip!
@frausy: That does look pretty slick, will definitely give it a go. Here is a link for anyone interested: http://sites.force.com/appexchange/listingDetail?listingId=a0N300000016cUTEAY
VJ
// Aug 27, 2009 at 9:32 am
The field mappings can only be saved, when you are doing a Insert/Upsert/Delete operation. NOT when you want to Export from SF