Making email migration an easy ride ™ - time after time!

Batch email conversion to the PST format using the command line

Batch email conversion to the PST format using the command line

What it is all about... New release of Outlook Transfer software introduces the batch messages conversion to PST format with the support of command line parameters. This guide describing what is batch scripts and command line and how to use them to run the bulk email conversion. Learn how to convert emails to PST format automatically with new Batch Mode and convert eml to pst in command line.

Table of Contents

Introduction to batch mode

As of version 5.3.1.1 PRO (Business, Technical) all our software supports command line parameters and execution. This allows for automatic batch conversion of e-mails to the PST format with minimum manual operations.

Batch email conversion Who possibly needs this kind of functionality? In fact, our users often ask the technical support team how they import lots of email files into different PST files more or less automatically. A typical task is a number of mailboxes belonging to multiple users that must be converted to PST files and imported to Outlook. Without batch mode conversion, the problem had only one solution: pick one user account and create a PST file manually, then go to the next one.

Surely, going through hundreds of mailboxes one by one manually is one hell of a disaster. Even with convenient software like ours this task may easily take hours. The worst thing is that you can’t leave the process just running – you still have to control it and manually pick the next mailbox for conversion and specify the target PST file as well.

Hence the need for batch email conversion that is implemented through command line prompt available since version 5.3.1.1 in all our email importing products. For example with EML to Outlook Transfer (Business or Technical) you may now convert eml to pst using command line.

What is command line prompt

For those of you who do not know what the heck the command line is, here is a brief explanation.

Command prompt illustration Long before graphical user interfaces (GUI) had become a mainstream, there were command line interfaces. Users performed actions by typing various commands into the text prompt and hitting Enter. Of course, this required memorizing a lot of various commands and their parameters, but that was it.

With today’s responsive and straightforward GUI, popularity of command line execution is much lower. Yet still command prompt is widely used in server administration, OS configuration, networking and so on. Also, command line prompt is an integral part of Microsoft Windows OS, so it is still available for those who know how to use it.

This article will teach you how to use the command line prompt for batch email conversion in examples of conversion of eml to pst via command line.

Batch email conversion using command line

Overview

To convert multiple mailboxes of one source format to PST using one of our products, you should first configure the program for automatic execution. Then you execute the conversion tool and pass the command line parameters that specify the source mailbox and the output PST file and the path to it. To convert multiple files, you simply need to execute the command multiple times with different parameters. The simplest way to do this is creating a batch file (*.BAT).

Now, let’s take a closer look at how to use bulk email conversion, step by step.

Preliminary configuration

Since we are aiming to completely automatic execution, any prompt or query the application makes to you during the process will pause the conversion and wait for your answer. Needless to say, this will effectively make the process non-automatic, so we need to configure the Outlook Transfer program first to prevent it from asking unnecessary questions when run from the command prompt.

For instance, you should preliminarily select the Outlook folder where the resulting PST files should be saved to.

Outlook folder selection dialog

Also, you should configure conversion options beforehand.

Outlook Transfer software options

Of course, if 100% automation is not a priority for you, you can skip pre-configuration and select all the necessary options during the batch job while emails are converted. On the other hand, for fully automatic bulk conversion launching the program just once is a reasonable requirement.

Now, close the program to save the settings. You are ready to convert eml to pst from the command line now. So run the batch conversion…

Using command line to convert emails to Outlook

Ok, now we have configured the program so it would not ask us questions and is capable of working in a 100% automatic mode. Now, how you can run bulk conversion of emails from the command prompt?

We will explain exporting emails to PST using EML to Outlook Transfer software as an example. But please remember that the same principle works for all other email importing utilities on our website. So you can use batch conversion to turn any of supported mailbox formats to PST by simply adapting the examples shown below to another Outlook Transfer utility.

Bring up the command line prompt

Press Win+R on your keyboard. This will open the Run dialog.

WIndows RUN window

You have two ways here:

  1. If you want to execute just one command, you can type this command directly in the Run dialog. Press the Enter button on your keyboard to execute the command.
  2. If you want to execute multiple commands at once, type CMD in the Run command prompt instead. Press Enter to execute the command. This will open the command line prompt in a new window:

Command prompt Windows CMD

Here, you can type and execute one command, then type and execute another one and so on. Unlike the Run dialog, the command prompt window remains on the screen until you explicitly close it.

Execute the command

A command that executes EML to Outlook Transfer (click to download) and tells the program to convert the source EML file to the target PST file looks like this:

C:\Program Files (x86)\EML to Outlook Transfer\emltransfer32.exe <source> <target> /r

Here:

  • <source> is the path to the folder, where the source email files are stored. All email files in that folder will be converted to PST. Also, if there are subfolders at the specified path and these subfolders also contain mailboxes, they will be converted too.
  • <target> – is the path to and the file name of the resulting PST file.

    Important! The specified path must exist. Make sure the folder you want to convert email files from really exists. Otherwise, the program will be unable to save the conversion result.
    Source and Target should be specified as first and second parameters of the command line.

  • /r – this parameter executes automatic conversion. If omitted, the application starts with the specified source and target parameters already specified, and will wait for the user to manually start the conversion process. If you want automatic conversion without any questions asked, specify this parameter.
  • /q – quits the program upon completion. When using this parameter please remember that LOG file will be overwritten by each new conversion session. If you want to inspect the LOG file prior to start the next conversion, you may need to include the PAUSE or COPY command into your BAT file.
  • /e – mutes most of the error messages. Outlook Transfer program will write error messages to the LOG file, but will not display them on screen.
  • /a – adds a timestamp to the LOG file name.
  • /i – enables the import into Inbox folder (menu Options > Target Outlook Folder > Inbox)
  • /t – switch the import to the Root folder of the PST file (menu Options > Target Outlook Folder > Top of Outlook Folders)

    Note: if one of these (/i or /t) parameters is not specified program may prompt you to select the folder during the batch execution.

  • /c – enables the correction of Unix or Mac OS encoding of imported emails (Options > Correct Email Encoding). Add zero to disable this option i.e. /c0
  • /n – enables the folders and subfolders creation in PST file (menu Options > Create Nested Folders Structure in Outlook) Add zero to disable the Outlook folders creation in PST file. i.e. /n0
  • /x – enables the usage of the internal formats processor. Add zero to turn on the external format processor (Outlook MAPI converter) i.e. /x0 Internal formats processor uses the basic functions of the Messaging Application Programming Interface and handles all extended conversion functions itself. External formats processor means the full use of the Outlook MAPI converter without any corrections. It works faster but occasionally MAPI_E_NOT_ENOUGH_MEMORY may occur at very large arrays of data. Unfortunately we can do nothing about Outlook converter, that’s why we recommend to use the Internal processor in most cases.
  • /s<value> – enables output PST file splitting to the smaller parts. <value> – value should correspond to the one of the predefined volume size: 1,2,3,4,5.10,15,20 (Gb) or 500 (Mb). To split output PST file to the 500Mb parts, use the parameter /s500, to split output PST file to parts of 2Gb use /s2 parameter. Use /s0 to disable the PST splitting.
  • /begin:<value>, /end:<value> – this couple of parameters cannot be used separately. Use them to specify the portion of sources for the conversion. For example if you have 30000 emails and want to convert the first 100, you have to specify the following: /begin:1 /end:100. The same parameters can be used to split the amount of imported sources to smaller portions, for example if you have 1000 EML files and want to create two PST files containing 500 emails each, you may use the following commands: /begin:1 /end:500 for the first run and /begin:501 /end:1000 for the second run.
    Important: these command-line switches should not be used for processing mailbox files. Using these switches with mailboxes will count the amount of mailbox files, not the emails inside these mailboxes!
    Note: above parameters are excluded from the demo edition of our software.

* – Command line parameters (batch conversion) available for the Business software license owners and/or Professional software edition.
* – If one of these parameters is not specified, the program will load and use the settings saved by the previous program run, except the options which program do not save.

For instance, if you want to convert EML files located in D:\Programs\Thunderbird\Mail\ and save them to PST file at C:\Outlook\Mail\john-thunderbird.pst, the corresponding command should be:

C:\Program Files (x86)\Thunderbird to Outlook Transfer\thunderbirdtransfer32.exe D:\Programs\Thunderbird\Mail\ C:\Outlook\Mail\john.pst /r /q

* – convert eml to pst command line parameters.

Important note #1

If a path contains spaces, it must be wrapped to quotes in the command prompt.
For instance: “C:\Program Files (x86)\EML to Outlook Transfer\emltransfer32.exe” “D:\Program Files\EML\Mail\” “C:\Outlook\Mail\john 2019.pst” /r /q

Important note #2

Running batch conversion implies that you want to save the result to a PST file. Direct importing to Outlook is not possible in the batch mode, so the Save to PST option is enabled automatically, when you execute bulk email transfer.

Important note #3

You must use the same bitness of the email conversion application and Outlook to perform conversion successfully. For instance, if you use 32-bit Outlook, you should run the 32-bit executable of EML to Outlook Transfer: emltransfer32.exe. If you run the 64-bit version of Outlook, correspondingly you should specify the 64-bit executable in the command line: emltransfer64.exe. The same is applied for other email conversion tools too.

Using BAT files to run multiple batch email conversions

What is a BAT file

The Windows operating system has the built-in capability to execute multiple commands one by one. BAT files (where BAT stands for batch execution) are simple text files with the .bat filename extension containing commands, one per line. When you execute a BAT file, the operating system starts executing all commands in that file starting from the first line, one by one. It is also called – batch script.

Batch script files are a convenient way of executing multiple commands and thus perfectly matches the task of bulk e-mail conversion.

Batch conversion of multiple folders with emails using BAT files

First of all, you need to create a .bat file using any plain text editor like Notepad. If you want to use some WYSIWYG editor like Microsoft Word, you will have to save the .bat file in the plain text format, otherwise the operating system will not be able to execute it.

Put all commands you want to execute to the .bat file, one command per line.
For example:

C:\Program Files (x86)\EML to Outlook Transfer\emltransfer32.exe “c:\email files 2017\” “c:\archive\2017 year.pst” /r /q
C:\Program Files (x86)\EML to Outlook Transfer\emltransfer32.exe “c:\email files 2018\” “c:\archive\2018 year.pst” /r /q
C:\Program Files (x86)\EML to Outlook Transfer\emltransfer32.exe “c:\additional email files 2018\” “c:\archive\2018 year.pst” /r /q

Here, we first convert EML files stored in the c:\email files 2017 folder and save the result to the PST file named c:\archive\2017 year.pst. Then, the same way we transfer all EML files from the c:\email files 2018 folder to the PST file named c:\archive\2018 year.pst. Finally, the third command starts conversion of EML files in the c:\additional email files 2018 folder to the previous PST file, c:\archive\2018 year.pst i.e. it is appending the existing PST file with the EML files located in c:\additional email files 2018 folder.

Note how paths above are wrapped into quotes, because paths and file names have spaces in them. It goes without saying paths and files names can be totally different than in the above example. That depends on real paths where the source emails are located and the folders where you want to save the resulting Outlook PST files.

You may expand your BAT file with another commands, so it will show you the key points for the email conversion, time taken to convert emails and pause the conversion to inspect or copy the LOG file. So it may look like this for example:

Batch email conversion - BAT file example

Now, we save this BAT file under the name of convert2017-2018.bat to any folder. Let’s say we saved it to d:\email conversion\convert2017-2018.bat.

Executing the BAT file

To execute the BAT file you created, bring up the command prompt by pressing Win+R. Type the full path to the .bat file – d:\email conversion\convert2017-2018.bat – into the command prompt box:

Windows RUN window with entered command to run BAT file

Press Enter to execute this command. The operating system will launch this BAT file, open it and execute every command in it. Specifically, our batch file will add the contents of two folders, c:\email files 2017 and c:\email files 2018, to two PST files, correspondingly, c:\archive\2017 year.pst and c:\archive\2018 year.pst. Then, the third command appends emails from the c:\additional email files 2018 folder to the c:\archive\2018 year.pst PST file.

Conclusion

We have added batch email conversion feature to our email conversion software to let our users enjoy faster and less tedious automatic conversion of multiple email accounts to the PST format. While our software is already very easy to use, with the new bulk conversion working with hundreds of user accounts and effortlessly converting them all to Outlook PST in one simple command entered to the command prompt.

You can download the latest versions of our email conversion software featuring batch execution of the email conversion process here: https://www.outlooktransfer.com/free-trials/

Read about Outlook command line switches.

Other KB Articles


How to Open a MBOX File

An MBOX file is a mailbox format that stores email messages one after the other as a plain text. Each individual message within mbox file stored in EML format. If…

How to convert OST to PST using Outlook

An OST file, or Offline Storage Table file, is a type of file used by Microsoft Outlook to store a copy of mailbox information from an Exchange server. A PST…

How to add Microsoft Teams to Outlook

Outlook is the Microsoft Office email platform used by millions of people worldwide. You may want to add MS Teams to Outlook, whether that’s being able to collaborate with your…

How to Export and Import Mailbox Content in Outlook on Windows

Sooner or later, Outlook users are faced with the question of how to export Outlook mail and contacts or how to import Outlook messages from another e-mail program. Below we…

Frequently Asked Questions – Issue 2

Meet the brand new issue of Frequently Asked Questions about mail conversion, migration to and from various e-mail clients, and other related topics. Q: How comes the IncrediMail to Outlook…

How useful was this post?

Click on a star to rate it!

Average rating 4.4 / 5. Vote count: 7

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

 
Comments

The batch email conversion and command line switches is very helpful option when you need to convert emails to Outlook often. Amazing set of commands, guys, thank you for this! It is the only conversion software on market that equipped with such amount of different commands.

Leave a Reply

 

Batch email conversion to the PST format using the command line

time to read: 11 min