Loading

Salesforce Platform: How to Configure and Run Salesforce Data Loader in Batch Mode on Windows

Дата публикации: Aug 17, 2026
Описание

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.

Step 1: Generate an Encryption Key for Data Loader 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.

For Data Loader Version 42 or Earlier

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.

For Data Loader Version 43 or 44

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!

For Data Loader Version 45 or Later

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>

Step 2: Create an Encryption Password for Data Loader

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.

For Data Loader Version 42 or Earlier

Replace <password> with your Salesforce login password and <filepath> with the location of key.txt.

encrypt.bat -e <password> "<filepath>\key.txt"

For Data Loader Version 43 or Later

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"

Step 3: Create a Field Mapping File for Data Loader

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

Step 4: Create the Data Loader Configuration File (process-conf.xml)

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"/>

Key Configuration Parameters in process-conf.xml

  • sfdc.endpoint: Your Salesforce login URL (for example, https://login.salesforce.com)
  • sfdc.username: The username Data Loader uses to log in to Salesforce
  • sfdc.password: The encrypted password generated in Step 2
  • process.encryptionKeyFile: Path to the encryption key file from Step 1
  • process.mappingFile: Path to the .sdl field mapping file from Step 3
  • dataAccess.name: Path to the CSV data file to import
  • sfdc.debugMessages: Set to true or false to enable SOAP (a protocol for exchanging data) message logging for troubleshooting
  • sfdc.debugMessagesFile: Path to the file where SOAP messages are stored
  • process.outputSuccess: Path to the success log file
  • process.outputError: Path to the error log file
  • dataAccess.type: Specifies whether Data Loader reads from or writes to a file (for example, csvRead for input, databaseWrite for output)

Step 5: Run the Data Loader Process from the Command Line

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_US
Номер статьи базы знаний

000386154

 
Загрузка
Salesforce Help | Article