Salesforce Data Loader is a tool used to import, export, insert, update, or delete large volumes of Salesforce records. By default, Data Loader runs with a graphical user interface (GUI). However, it also supports batch mode, which is a method of running Data Loader from the Windows Command Prompt without opening the GUI. Batch mode is useful for scheduling automated, recurring data operations.
This article describes the configuration steps required to run Data Loader in batch mode on Windows, using an Insert operation as an example.
Example: A Salesforce administrator needs to automatically import new Account records every night from a CSV file. Instead of manually running Data Loader each time, the administrator configures Data Loader to run in batch mode on a schedule using Windows Task Scheduler.
This article answers the question: how do you configure and run Salesforce Data Loader in batch mode from the Windows command line without the GUI? Complete the following five steps in order to configure and run Data Loader in batch mode.
An encryption key is used to encrypt (scramble for security) your Salesforce login password so it can be stored safely in the configuration file.
Open the Windows Command Prompt and navigate to the Data Loader installation directory. Then generate an encryption key using any string. Replace <seedtext> with any string of your choice.
cd C:\Program Files (x86)\salesforce.com\Data Loader\bin
encrypt.bat -g <seedtext>
Example output:
security.EncryptionUtil main (EncryptionUtil.java:304) - ***************
Copy the output key (shown as ***) to a text file and save it as "key.txt". This key is used to encrypt your password in Step 2.
Navigate to the Data Loader installation directory. Then generate an encryption key file. Replace <path to key file> with a directory path and file name ending in .key. If you do not specify a path, the file is saved to the default location.
cd C:\Program Files (x86)\salesforce.com\Data Loader\bin
C:\Users\<Windows_username>\.dataloader\dataLoader.key
encrypt.bat -k <path to key file>
Verify the key file was created. Example output:
Keyfile "C:\Users\<Windows Username>\.dataloader\dataLoader.key" was created!
Navigate to the Data Loader installation directory. Then generate an encryption key file with the same command used for version 43 and 44. Verify the key file was created successfully.
C:\Users\<Windows Username>\dataloader\<Dataloader version>\bin
encrypt.bat -k <path to key file>
Use the encryption key from Step 1 to convert your Salesforce login password into an encrypted password for use in the configuration file.
Note: The password used to log in to Data Loader is typically different from your Salesforce login password. Your Salesforce password also requires a security token (a code appended to your password for API access). See the Additional Resources section for how to reset your security token.
Replace <password> with your Salesforce login password and <filepath> with the location of key.txt.
encrypt.bat -e <password> "<filepath>\key.txt"
Replace <password> with your Salesforce password and provide the path to your .key file.
encrypt.bat -e <password> "C:\Users\<Windows Username>\.dataloader\dataLoader.key"
A field mapping file (.sdl) maps the columns in your input CSV file to the corresponding fields in your Salesforce object. Create a new text file and save it with the .sdl file extension. Define the column mappings using the following syntax, where the left side is the CSV column and the right side is the Salesforce field.
SLA__C=SLA__c BILLINGCITY=BillingCity
The configuration file (process-conf.xml) is an XML file (a structured text file used to store settings) that tells Data Loader how to connect to Salesforce and where to find your data and mapping files. Copy the sample process-conf.xml file from the Data Loader installation directory, then edit the file with your login details and file paths. Use the configuration sample below as a reference.
\samples\conf\process-conf.xml
<entry key="sfdc.endpoint" value="https://login.salesforce.com"/> <entry key="sfdc.username" value="youremail@example.com"/> <entry key="sfdc.password" value="******encryption password from Step 2******"/> <entry key="process.encryptionKeyFile" value="key.txt"/> // For version 42 and earlier <entry key="process.encryptionKeyFile" value="C:\Users\<Windows Username>\.dataloader\dataLoader.key"/> // For version 43+ <entry key="process.mappingFile" value="test.sdl"/> <entry key="dataAccess.name" value="test_data.csv"/> <entry key="sfdc.debugMessages" value="true"/> <entry key="sfdc.debugMessagesFile" value="testMap.sdl"/> <entry key="process.outputSuccess" value="C:\test\success.csv"/> <entry key="process.outputError" value="C:\test\error.csv"/> <entry key="dataAccess.type" value="csvRead"/>
Once all files are configured, run the batch process from the Windows Command Prompt. Replace <file path to process-conf.xml> with the directory containing your process-conf.xml file, and <process name> with the bean ID defined in the configuration file (the value in bean id="*****").
process.bat "<file path to process-conf.xml>" <process name>
Once complete, Data Loader runs the specified data operation (such as Insert) from the command line without requiring the GUI.
- Run in Batch Mode (Windows Only): https://developer.salesforce.com/docs/atlas.en-us.dataLoader.meta\/dataLoader\/loader_batchmode_intro.htm
- Data Loader Command Line Introduction: https://help.salesforce.com/HTViewHelpDoc?id=command_line_intro&language=en_US
- Create the Configuration File: https://help.salesforce.com/apex/HTViewHelpDoc?id=command_line_create_config_file.htm&language=en_US
- Data Loader Process Configuration Parameters: https://help.salesforce.com/HTViewHelpDoc?id=loader_params.htm&language=en_US
- Create the Field Mapping File: https://help.salesforce.com/articleView?id=command_line_create_mapping_file.htm&language=en_US&type=0
- Reset Your Security Token: https://help.salesforce.com/HTViewHelpDoc?id=user_security_token.htm&language=en_US000386154

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.