NK2Edit

NK2Edit v2.95
Copyright (c) 2010 - 2014 Nir Sofer
Web site: http://www.nirsoft.net/utils/outlook_nk2_edit.html

Introduction

Every time that you type an email address or name in the message window of MS-Outlook, it automatically offer you a list of users and email address that you can choose. This feature is known as 'AutoComplete' and Outlook automatically build this emails list according to user activity and save it into a file with .NK2 extension.

In some circumstances, you may need to repair or modify the values appeared in the AutoComplete list, or you may want to remove unwanted email addresses and/or to add new email addresses. MS-Outlook doesn't provide any ability to edit this AutoComplete list, so this is where NK2Edit software can help you.

NK2Edit Features

  • Easily modify or fix all information stored in the NK2 file, including the display name, the email address, the exchange string, the Drop-Down display name, and the search string.
  • Easily remove unwanted single quote characters from the display name and from the Drop-Down list.
  • Delete unwanted emails, as well as add new emails, by typing them manually, or by choosing them from the address book of Outlook.
  • Copy NK2 records from one NK2 file to another - simply by copy and paste !
  • Build a completely new NK2 file and add the desired emails into it, by typing them manually, by adding them from your address book, or by copying records from another NK2 file.
  • Extract data from corrupted NK2 files that Outlook cannot read anymore (When Outlook AutoComplete stopped working) and even repair them so Outlook will be able to read them again.
  • Export all data stored in the NK2 file into a special Unicode text file in a structure similar to .ini file of Windows. You can open it any text editor you like, make the changes you need, and then convert it back into NK2 file that Outlook can use.
  • Export the emails information stored inside NK2 file into HTML/Text/csv/xml file.
  • Export the emails information stored inside NK2 file directly into the contacts of Outlook.
  • Copy the selected NK2 records in tab-delimited format and then paste the information into Excel.
  • Change the order of the records in the NK2 file, which also affects the order they appear in the drop-down. You can also sort the list in alphabetical order of the Drop-Down display names. (However, be aware that Outlook change the order again when the user send emails)
  • Command-Line Support: Write simple scripts that can add, remove, or modify records inside the NK2 file, without displaying any user interface.
  • NK2Edit is a portable application that can be used from any computer with Windows operating system (Starting from Windows 2000) without need of any installation process, and without making changes in the Registry.
  • NK2 Control Center - Allows you to watch to location and the status of all NK2 files in your organization.

System Requirements

  • NK2Edit works on any version of Windows, starting from Windows 2000 and up to Windows 7/2008. NK2Edit is a Unicode based application, and thus it cannot work under Windows 95/98/ME.
  • NK2Edit can read, write, and create NK2 files for Outlook 2003, Outlook 2007, Outlook 2010, and Outlook 2013.
  • Outlook installation is not required on the computer that you run NK2Edit, except of "Add Records From Address Book" feature, which cannot work without Outlook. NK2Edit can also be used to open, edit, and save NK2 files on remote computers in your network, as long as you have read/write permission to the remote NK2 file.

License

The license for using NK2Edit is different from most of other NirSoft utilities:
  • The basic version of NK2Edit (Without the commercial license features) is completely free for personal use at your home and for using in any charity/non-profit organization.
  • If you need to use NK2Edit in a company/business organization, you can freely try and evaluate the NK2Edit software for 14 days and verify that the software really works as you expect.
  • If after the 14-days of evaluation you decide to continue using it, you have to purchase a
  • commercial license according to the number of workstations with Outlook that NK2Edit is needed for opening or editing their NK2 file.
    For more information about commercial licenses, click here

Disclaimer

The software is provided "AS IS" without any warranty, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason.

NK2Edit vs NK2View

NK2View was originally released as a small free tool for viewing the content of NK2 files. After many requests from users, I added some limited editing features that allowed the users to remove and add records into the NK2 file. However, NK2View was not designed to be a real NK2 editor, and for some NK2 files, it failed to add/remove records properly.

As opposed to NK2View, NK2Edit was designed as a real NK2 editor that can make any change you need and then save it back into a valid NK2 file.

Using NK2Edit Without Installation

NK2Edit can be used without any installation process. Simply download the zip file of NK2Edit, extract the files into any folder you like, and run the executable file (NK2Edit.exe) . You can also put the files of NK2Edit in a shared network drive, and run it from any workstation in your company.
Whenever you want to remove NK2Edit from your system, simply delete the files of NK2Edit (NK2Edit.exe, NK2Edit.cfg, and NK2Edit.chm). NK2Edit doesn't write anything to the Registry or other places, so deleting the files is enough for removing NK2Edit completely from your system.

Using NK2Edit With Install/Uninstall Support

If you want, you can also download NK2Edit with installer (NK2Edit_setup.exe), and install NK2Edit like any other software. The installer of NK2Edit automatically add a new group to the start menu of Windows and it also add a new entry to the uninstall list of Windows, so you'll be able to easily uninstall NK2Edit if it's needed.

x64 Version of NK2Edit

NK2Edit has 2 features that extract address book/mailbox information directly from Microsoft Outlook: "Add New Records From Address Book" and "Add Records From Mailbox Recipients".

If you use the 64-bit version of Microsoft Outlook 2010 or Microsoft Outlook 2013, you must download and use the x64 of NK2Edit in order to use the above 2 features. In all other cases, you should use the 32-bit version of NK2Edit. Be aware that if you have 64-bit Windows installation, but the installation of MS-Outlook is 32-bit, you must use the 32-bit version of NK2Edit in order to use the above 2 features.

Before You Start

  • When you edit your NK2 file, remember to verify that the executable of Outlook (Outlook.exe) is not running. If you edit the NK2 file when Outlook is opened, Outlook may save the NK2 file and overwrite your changes.
  • Backups of NK2 file: When you make changes in your NK2 files, it's always important to keep a backup of the original NK2 file, so if something goes wrong and the modified NK2 doesn't work properly, you'll be able to restore the original one.
    When you save your NK2 changes in the first time, NK2Edit automatically creates a backup of the original NK2 file with NK2Edit.First.bak extension. To restore the original NK2 file, simply use the 'Restore Backup From First Save' option. You can disable the automatic backup by unchecking the 'Automatically Backup On First Save' in the Options, although it's recommended to keep this options enabled.
    In addition to the automatic backup of the first save, NK2Edit also allows you to create a backup when you think it's important. Simply use the 'Backup Current NK2 File' option, and NK2Edit will create a backup file with .NK2Edit.bak extension.
  • Know the limitation for number of records in NK2 files: Outlook 2003 limits the maximum number of records in NK2 files to 1000, while Outlook 2007/2010 limits the maximum number of records to 2000. When you edit your NK2 files, you should keep the number of records below these limits. See Also: Size limit of Outlook AutoComplete (.NK2) file.
  • In Outlook 2010 and Outlook 2013, the AutoComplete file is saved with .dat extension and its header data is a little different from the previous versions of Outlook. In order to save the AutoComplete file for Outlook 2010/2013 properly, you have to save the file with .dat extension, so NK2Edit will save it with the new file header of Outlook 2010.
  • If you're going to use NK2Edit with Outlook 2010/2013, you should read the following information page about the AutoComplete changes made in Outlook 2010:
    AutoComplete feature changes on Outlook 2010 and later versions

Versions History

  • Version 2.95
    • Added 'EmailString' field to NK2Edit scripts. This field represents the email address string for both SMTP records and Exchange records.
  • Version 2.94
    • Fixed bug: NK2Edit failed to merge MAPIPDL records.
  • Version 2.93
    • Added secondary sorting support: You can now get a secondary sorting, by holding down the shift key while clicking the column header. Be aware that you only have to hold down the shift key when clicking the second/third/fourth column. To sort the first column you should not hold down the Shift key.
  • Version 2.92
    • Fixed the record edit dialog-box to select all characters of focused text-box when using the tab key to move to the next field.
  • Version 2.91
    • Added 'Copy As Simple CSV' option.
  • Version 2.90
    • The Paste option (Ctr+V) now also accepts text in a simple comma-delimited format, for example:
      SMTP, NirSoft Support, support@nirsoft.net
      EX, NirSoft Admin, /o=NirSoft/ou=First Administrative Group/cn=Recipients/cn=Admin
  • Version 2.87
    • NK2Edit now displays an error message if the log file (/LogFile command-line option) cannot be created.
  • Version 2.86
    • The first line of the log file generated by NK2Edit now also provides the current version of NK2Edit.
  • Version 2.85
    • Added 'Clear Recent Files List' option.
  • Version 2.84
    • The first line of the log file generated by NK2Edit now provides the computer name and user name information.
  • Version 2.83
    • The 'About' window now displays the build that you're running: 32-bit or 64-bit.
  • Version 2.82
    • Fixed a bug with /SkipCommandLineNoProfiles command-line option on Outlook 2013.
  • Version 2.81
    • Added /SkipCommandLineNoProfiles command-line option. If it's set to 1, then the /script, /script_express, and /export_to_message_store commands will not do anything if there are no Outlook profiles on the computer you run it, for example:
      NK2Edit.exe /SkipCommandLineNoProfiles 1 /LogFile "express_log.txt" /script_express $default 'If AddressType equal "EX" EXToSMTP' 'If Domain Equal "gmail.com" Delete'
  • Version 2.80
    • Added /RestoreBackup command-line option, which restores the last backup made by NK2Edit on the default AutoComplete file.
  • Version 2.78
    • Added /CompleteMessage command-line option, which instructs NK2Edit to display a message to the user when a command-line action is completed, for example:
      NK2Edit.exe /CompleteMessage "Finished executing the script of NK2Edit" /LogFile "express_log.txt" /script_express $default 'If AddressType equal "EX" EXToSMTP' 'If Domain Equal "gmail.com" Delete'
  • Version 2.77
    • Added 'Copy Emails Only' option, which copies the emails of all selected records to the clipboard, each email in a separated line.
  • Version 2.76
    • NK2Edit now displays an error message if it cannot change the sending format ('Change Sending Format To...' action).
  • Version 2.75
    • Added /WarnIfOutlookRunning command-line option. You can use it with /script , /script_express , and other command-line option to warn the user if Outlook is running.
    • Added /TimestampBackup command-line option. You can use it with /script , /script_express , and other command-line option to create a separated backup every time that the command-line is executed. The backup filename is generated with a timestamp, for example: 1.nk2.20130813111927.NK2Edit.bak
  • Version 2.72
    • Added option to change the characters encoding of the files generated by the 'Export Selected Items' option and by the export command-line options (/stab, /scomma, /shtml and so on...) - UTF-8, UTF-16, or Ascii
    • You can also change the characters encoding from command-line by using the /ExportCharEncoding command-line option. For example, in order to export all AutoComplete items to csv file with UTF-8 encoding:
      NK2Edit.exe /ExportCharEncoding 1 /scomma "simple.csv"
    • Simple CSV File - Changed the default encoding to UTF8 and removed space characters, so this file will be opened properly in Excel.
  • Version 2.71
    • Added /LogFileAppend command-line switch, which is very similar to /LogFile command-line switch, but instead of overwriting the file, /LogFileAppend appends the new log lines to the existing file.
  • Version 2.70
    • Added new package containing both 32-bit and 64-bit builds of NK2Edit (In addition to the separated 32-bit and 64-bit downloads). This package contains a third executable (named nk2edit.exe) which automatically executes the correct .exe file according to the installed version of Outlook. Both executables (32-bit and 64-bit) share the same configuration file (nk2edit.cfg) if they are executed from nk2edit.exe
      This package might be useful for you if you have mixed environment with some computers running Outlook 32-bit and some computers running Outlook 64-bit.
      For more information: Using NK2Edit in mixed environment of computers running Outlook 32-bit and Outlook 64-bit
  • Version 2.68
    • Added Like operator to the NK2Edit scripts, which allows you to compare a field value using wildcard, for example: if Email Like "a???@*.net" delete
  • Version 2.67
    • When exporting the AutoComplete file of Outlook into the Exchange message store ( /export_to_message_store command-line option) NK2Edit automatically sets the version of the file to 12 if the original AutoComplete file has an older version number.
  • Version 2.66
    • Added secondary sorting for the Domain column. When clicking the header of the domain column, the list is first sorted by the domain, and then by the email address.
  • Version 2.65
    • Added /AutoExportToMessageStore command-line option. You can use it to automatically export the AutoComplete data to the message store of Outlook, On Outlook 2010 or greater. For example:
      NK2Edit.exe /AutoExportToMessageStore 1 /script "f:\scripts\myscript.txt" $default
    • Added /script_express command-line option, which allows you to run a small script without using external script file, for example:
      NK2Edit.exe /LogFile "express_log.txt" /script_express $default 'If AddressType equal "EX" EXToSMTP' 'If Domain Equal "gmail.com" Delete'
  • Version 2.60
    • Fixed bug: NK2Edit failed to import MAPIPDL records (distribution lists) when using /import_address_book and /sync_address_book command-line options.
    • You can now specify multiple address types in /import_address_book and /sync_address_book command-line options, for example:
      NK2Edit.exe /import_address_book $default "Contacts" "MAPIPDL+SMTP" 2000
  • Version 2.57
    • Added 'RemoveLinkToProfile' action for using in NK2Edit scripts, for example:
      If AddressType equal "SMTP" RemoveLinkToProfile
  • Version 2.56
    • Added 'Remove Link To Outlook Profile' option. This option is useful for SMTP records that are linked to specific Outlook profile (Linked To Profile = 'Yes') After using this option to remove the linkage to Outlook profile, you'll be able to safely copy the records into another AutoComplete file.
  • Version 2.55
    • Added 'EntryID' column.
    • Added 'Linked To Profile' column. If the value under this column is Yes, it means that the record is linked to a contact or address book item on your Outlook profile, and it'll stop working if you copy this record into another Outlook profile.
  • Version 2.53
    • You can now resize the 'Edit Record' window. Also, the last size and position of this window is saved to the config file, so this window is opened with the last size/position you chose.
  • Version 2.52
    • Fixed the flickering occurred while scrolling the AutoComplete records list.
  • Version 2.51
    • A warning line is now added to log (/LogFile command-line option) when NK2Edit fails to locate the default AutoComplete file.
  • Version 2.50
    • Added 'SMTP Address' field to the 'Edit Record' window (For Exchange records only).
  • Version 2.45
    • Added support for replacing string of 'SMTP Address' field in the 'Find & Replace' option (Ctrl+P) .
  • Version 2.43
    • Added Weight field for the 'if' command in NK2Edit script, for example to delete all records with Weight lower than 10:
      if Weight LessThan 10 delete
  • Version 2.42
    • Added DisplayType field for the 'if' command in NK2Edit script. You can use it to delete all records with specific 'Display Type' value. You can use the following numeric values: 0 for Mail User, 1 for Distribution List, 5 for Private Distribution List, and 6 for Remote User.
      For example, to delete all non-private distribution lists:
      if DisplayType Equal 1 delete
  • Version 2.41
    • Added 'Use SMTP Address In AutoFill Feature' option (Under the Options menu). This feature affects the way that NK2Edit automatically fills the Drop-Down Name and the Search String of EX records. If it's turned on, NK2Edit will use the SMTP address to fill the Drop-Down Name and the Search String. If it's turned off, MK2Edit will use the Exchange account name, like in previous versions of NK2Edit. For example: If this option is turned on, the Drop-Down Name will be 'Nir Sofer <nirsofer@nirsoft.net>'. If this option is turned off, the Drop-Down Name will be 'Nir Sofer <NIRS>'.
  • Version 2.40
    • Added 'Open Selected Address In Outlook' option (Under the File menu and the context menu). This option allows you to open the selected email address in Outlook. If this email address has an enrty inside the address books of your Outlook profile, this address book entry will be displayed. Otherwise, Outlook will open a simple dialog-box with the display name and email address.
  • Version 2.38
    • Fixed bug: On a few systems, NK2Edit crashed immediately on start.
  • Version 2.37
    • Added 'Automatically Export To Message Store' option (For Outlook 2010). If it's turned on, and you save the default AutoComplete file, NK2Edit will automatically export the saved file to the message store of Outlook (PST file or Exchange)
  • Version 2.36
    • Added 'Auto Size Columns+Headers' option.
    • Fixed issue: Dialog-boxes opened in the wrong monitor, on multi-monitors system.
  • Version 2.35
    • Added 'Export To Message Store' option (Only for Outlook 2010). Outlook 2010 maintains 2 copies of the AutoComplete data. One copy in the local file system (Stream_Autocomplete_*.dat), and another copy on the message store of your Outlook profile (PST file or Exchange server). This option allows you to copy the local AutoComplete .dat file into the message store of Outlook, to ensure that Outlook will not overwrite your changes.
  • Version 2.30
    • Fix for the 'Open Recent File' menu: When using the 'Save As' option to save into a new filename, the new filename will be added to the recent files menu.
  • Version 2.29
    • Fixed bug: For SMTP records that are linked to a contact, NK2Edit displayed that the sending format is 'Outlook Rich Text', while it should be empty, because this kind of records doesn't contain the sending format byte.
  • Version 2.28
    • Fixed bug: A script line that deletes all records with empty domain failed to work: If Domain Equal "" Delete
  • Version 2.27
    • Fixed the /import_full_nk2 command-line option to work with environment variables (e.g: %TEMP%).
    • You can now generate a log file (/LogFile command-line parameter) with /import_full_nk2 command-line option.
  • Version 2.26
    • Added more accelerator keys (in the Action menu).
  • Version 2.25
    • Added 'Allow To Overwrite Read-Only File' option. If it's turned on, NK2Edit will be able overwrite existing AutoComplete file even if it has a Read-Only attribute.
  • Version 2.20
    • Added /export_to_message_store comand-line option (For Outlook 2010). This command-line option copies the AutoComplete file stored in the local hard-drive (Stream_Autocomplete*.dat ) into the message store of the Exchange server (For MS-Exchange profiles) or into the .pst file (For Outlook profiles based on .pst file)
  • Version 2.16
    • Fixed a typo of the word 'Automatic' under the 'Sending Format' column.
  • Version 2.15
    • Added 'Convert EX to SMTP', under the Action menu, which converts the selected EX records to SMTP records
  • Version 2.11
    • Added option to set the sending format with NK2Edit scripts, by using 'Set SendingFormat = {value}'. The following values can be used:
      • 0 - Send using Outlook Rich Text Format
      • 1 - Let Outlook decide the best sending format
      • 7 - Send Plain Text Only

      Example:
      If AddressType equal "SMTP" Set SendingFormat 1
  • Version 2.10
    • Added 'Sending Format' column, which displays the format that Outlook will use when sending email message to the specified SMTP recipient: Automatic (Let Outlook decide...), Outlook Rich Text, or Plain Text. This column is only valid for SMTP records. Be aware that if the 'Sending Format' is Outlook Rich Text, the recipient that receives the message will get winmail.dat attachment if he doesn't have MS-Outlook or other email client that supports this message format.
    • Added 'Change Sending Format To...' (Under the Action menu), which allows you to change the sending format of the selected recipients.
  • Version 2.06
    • Fixed issue: When NK2Edit failed to read the script file (/script command-line option), 'Error 0' message was added to the log file, instead of the read error number.
  • Version 2.05
    • Added /import_full_nk2 command-line option, which imports all records of the specified nk2 file into the default Outlook profile. (Be aware that this action overwrites all the existing AutoComplete records with the records of the specified nk2 file.)
  • Version 2.03
    • Added Unicode byte order mark to the log file, so it'll be opened properly with all text viewers/editors.
  • Version 2.02
    • Added /CurrDirExe command-line option, which changes the current directory used for all other command-line options. By default, when you specify a filename without a path (For example: NK2Edit.exe /script "myscript.txt" $default ""), NK2Edit searches the file in the current directory returned by Windows operating system. In most cases, the current directory is where the .exe file of NK2Edit is located, but in some other cases (For example, when running NK2Edit from RunOnce Registry key), the current directory might be different.
      If /CurrDirExe is specified, NK2Edit will search the file in the same folder where NK2Edit.exe is located, even if the current directory of Windows operating system is different.
  • Version 2.01
    • Fixed issue: When using the combination of /script and /LogFile command-line options, without specifying the third parameter of /script (For example: NK2Edit.exe /script "f:\scripts\myscript.txt" $default /LogFile "f:\%computername%.txt" ), the script command was failed because the /LogFile was taken as the third parameter.
  • Version 2.00
    • Added 'Open Recent File' menu (under the File menu), which allows you to easily choose the NK2 file to open from a list of the last 10 NK2 files you previously opened.
  • Version 1.96
    • When trying to connect to Outlook 2010 ('Add Records From Address Book' and 'Add Records From Mailbox Recipients' options) with the wrong build of NK2Edit (NK2Edit 32-bit with Outlook x64 or NK2Edit x64 with Outlook 32-bit), NK2Edit now displays informative error message about the problem.
  • Version 1.95
      The /LogFile command-line option now can be used with /import_csv_file command-line option.
  • Version 1.94
      The /LogFile command-line option now can be used with /generate_new_nk2 command-line option.
  • Version 1.93
      The /LogFile command-line option now can be used with /sync_address_book command-line option.
  • Version 1.92
    • The /LogFile command-line option, which generates a log file with details about every action made by NK2Edit and information about errors/problems, now can be used with /export_to_contacts and /import_address_book command-line option. For example:
      nk2edit.exe /logfile "import_address_book_log.txt" /import_address_book "contacts.nk2" "Contacts" "All" 2000
      NK2Edit.exe /logfile "export_to_contacts_log.txt" /export_to_contacts $default
  • Version 1.91
    • Added Drag & Drop support: You can now open 2 instances of NK2Edit with 2 different NK2 files, and then drag NK2 items from one window to the other.
  • Version 1.90
    • Added the ability to set the weight value from a script. In the AutoComplete drop-down of Outlook, NK2 recipient with higher weight value is displayed above all other recipients with lower weight value. So if you set the weight value of important emails to very high number, these emails will be displayed in the top of the AutoComplete list, above all other emails.
      Example for a script line that sets a new weight value:
      if Email Contain "@mydomain.com" set weight 1000000
  • Version 1.87
    • In 'Add Records From Address Book' option - You can now also import private distribution lists from your contacts (records with MAPIPDL address type).
  • Version 1.86
    • Fixed problem with the 'Export Records To Outlook Contacts' feature: In previous versions, NK2Edit filled only the 'Full Name' field, but the First/Middle/Last Name fields remained empty. (this may cause BlackBerry / Outlook contacts synchronization problem)
      Starting from this version, NK2Edit automatically splits the display name of the NK2 record into First/Middle/Last Name fields, and fills the contact with these fields. This change also affects the /export_to_contacts command-line option.
  • Version 1.85
    • Added /ScriptInput command-line option. It allows you to create a script with parameters, and load the parameters from tab-delimited or comma-delimited file (csv). For more information about this new feature: Script With Parameters.
  • Version 1.80
    • Added EXToSMTP action for the 'if' command, which allows you to convert EX (MS-Exchange) record into SMTP record. This action only works if the 'SMTP Address' field stores the correct SMTP address of the EX record.
  • Version 1.79
    • 'Add New Record' window - After pressing Ok, the record is added and then this window is opened again for adding the next record. This change allow you to add multiple records more easily.
  • Version 1.78
    • Added 'Fix Drop-down Name And Search String' feature (In the Action menu), which allows you to fix the Drop-down Name and Search String values for the selected records, accoring to the email and display name values.
  • Version 1.77
    • Added more accelerator keys (in the menus).
  • Version 1.76
    • Added the option to choose the double-click action - Edit Record or Properties window.
  • Version 1.75
    • Added /sync_address_book command-line option. This command is very similar to /import_address_book command, but in addition to importing all emails from the address book into the NK2 file, it also deletes emails from the NK2 file that cannot be found inside the address book.
  • Version 1.74
    • Fixed bug: NK2Edit failed to save a record properly when switching from existing SMTP record to EX record or from existing EX record to SMTP record.
  • Version 1.73
    • Fixed problem with /import_address_book command-line option: In some Outlook/Exchange configurations, NK2Edit imported only some of the addresses of the global address list.
  • Version 1.72
    • Added EndWith and NotEndWith operators to the 'If' command of NK2 Scripts
  • Version 1.71
    • Added 2 new 'Records to scan' options in the Find & Replace window - 'All SMTP Records' and 'All Exchange Records'.
  • Version 1.70
    • Added 'Copy As Emails List' option (Ctrl+L) which allows you to copy to the clipboard the selected emails as semicolon delimited list that can be used in the To/CC fields of Outlook or other email software.
  • Version 1.69
    • Added 'New Email To Selected Contacts' (Ctrl+F2) under the File menu. You can select one or more SMTP addresses from the NK2 records list, and then use this option to compose a new message in your default email client for the selected addresses.
  • Version 1.68
    • Added 'Warn When Outlook Process is Running' option. When it's turned on, NK2Edit warns you if you try to save the default NK2 file and Outlook is currently running in the background.
  • Version 1.67
    • Added new script actions: ReplaceCS and ReplaceFieldCS.
  • Version 1.66
    • Added new script elements for the 'If' command: Domain (field name), LengthRange (Operator), and IsNumber (Operator).
  • Version 1.65
    • Added 'Merge With Another NK2 File' option (In Action menu), which allows you to easily merge all records from another NK2 file into the currently opened file.
  • Version 1.62
    • Added 'Mark Odd/Even Rows' option, under the View menu. When it's turned on, the odd and even rows are displayed in different color, to make it easier to read a single line.
  • Version 1.61
    • Added 'Show Selected SMTP/EX Counter' option (under the View menu). When it's turned on, the number of selected SMTP records and EX (Exchange) records is displayed in the bottom status bar.
  • Version 1.60
    • Added new file type into 'Export Selected Items' option - Simple csv file. This created csv file can be used with 'Add Records From Simple csv File' option to import back the emails into another NK2 file.
    • Added /ssimplecsv command-line option to export all records of the NK2 into a simple csv file.
  • Version 1.56
    • The import feature added in the previous version now also supports UTF8 files (with byte order mark - EF BB BF)
  • Version 1.55
    • Added 'Add Records From Simple csv File' option, which allows you to import addresses from a simple csv file into your NK2 file. See also: Import NK2 addresses from a simple comma-delimited (csv) text file
    • Added /import_csv_file command-line option (for licensed version), which allows you to import addresses from a simple csv without displaying any user interface.
  • Version 1.51
    • Added new command-line options to override the settings stored inside the configuration file (nk2edit.cfg). For more information, see the 'More Command-Line Options' section in the NK2Edit Command-Line Options page
  • Version 1.50
    • Added /open_control_center and /load_config command-line options.
  • Version 1.48
    • When NK2Edit tries to save the NK2 file, and the file is locked by Outlook, NK2Edit will now display easy to understand message that will recommend you to close Outlook.
  • Version 1.47
    • Added 'Save Question Instead of Discard Question' option. When this option is turned on and you try to exit from NK2Edit or to open another file after you made some changes in the current opened file, NK2Edit will ask you whether you want to save the changes in the current opened file. By default, when this option is turned off, NK2Edit asks you whether you want to discard the nk2 file changes.
  • Version 1.46
    • Added /import_contacts_file command-line option (for licensed version), which allows you to import emails/names from the Contacts csv file exported by Microsoft Outlook or by other email software/service, like Yahoo or Gmail, without displaying any user interface.
  • Version 1.45
    • Added 'Add Records From Outlook Contacts csv File' option. You can use it to import emails/names from the Contacts csv file exported by Microsoft Outlook or by other email software/service, like Yahoo or Gmail.
  • Version 1.43
    • Added /logon_profile command-line option, which allows you to easily make all contacts/mailbox related actions with the specified Outlook profile, instead of the default one.
  • Version 1.42
    • Added 'Error Messages On File Open' option. If you turn off this option (By default, it's turned on), NK2Edit won't display error messages when you open corrupted .nk2 file with missing records or other errors.
  • Version 1.41
    • Added 'Associate .nk2 Extension With NK2Edit' option. When this option is selected, the .nk2 extension inside Windows Explorer is associated with NK2Edit, which means that NK2 files with be displayed with the icon of NK2Edit and when you double-click on NK2 file, it'll be opened with NK2Edit. You can also add/remove the .nk2 file association from command-line - with /add_nk2_associate and /remove_nk2_associate
  • Version 1.40
    • Added 'Duplicate' column, which allows you to easily find duplicate NK2 records with the same display name/email. Simply click the 'Duplicate' column header, and you'll find all duplicate records in the top of the NK2 records list.
    • Also Added 'Mark Duplicate Records' option. When this option is turned on, all duplicate records are marked with different colors.
  • Version 1.35
    • Added /import_address_book command-line option (for licensed version) which allows you to import all addresses stored in your Contacts/Address Book/Global Address List directly into your NK2 file. Read the NK2Edit command-line options page for more information.
  • Version 1.32
    • The position and the size of the NK2 Control Center window is now saved into the NK2 config file, so it'll be loaded with the same size/position in the next time that you use NK2Edit.
  • Version 1.31
    • Added 'HTML Report' option in the context menu of the Control Center.
  • Version 1.30
    • Added 'Open Remote NK2 Folder' option in the context menu of the Control Center.
    • Added 'Find' option in the context menu of the Control Center.
  • Version 1.29
    • Added /ccenter command-line option, which allows you to export the Control Center information directly into a file, without displaying any user interface.
    • Added /ccenterfile command-line option, which allows you to specify the Control Center information file from command-line.
  • Version 1.28
    • Added 'Add Header Line To CSV/Tab-Delimited File' option. When this option is turned on, the column names are added as the first line when you export to csv or tab-delimited file.
  • Version 1.27
    • Added 'Export Selected Items' option (export to text/html/csv/xml file) into the context menu of the Control Center.
  • Version 1.26
    • Added /export_to_contacts command-line option (for licensed version) which allows you to export the emails from the specified NK2 file into the contacts of Outlook, without displaying any user interface.
  • Version 1.25
    • Added 'Export Records To Outlook Contacts' (under File menu), which allows you to easily export the select NK2 records directly into the contacts list of Outlook.
  • Version 1.22
    • Fixed a memory leak problem in 'Add Records From Mailbox Recipients' option.
  • Version 1.21
    • Fixed a crash problem in some command-line options.
  • Version 1.20
    • Added NK2 Control Center window, which allows to watch the status, the location, and general statistics of all NK2 files on your organization. This feature requires to add a single line into the logon script to collect the NK2 information.
  • Version 1.13
    • Added /generate_new_nk2 command-line option, which generates a completely new NK2 file from the email addresses stored in the Outlook mailbox.
  • Version 1.12
    • Added 'Remove Double Quotes From All Display Names' option.
    • Added RemoveDoubleQuotes command to NK2Edit scripts.
  • Version 1.11
    • When specifying empty string ("") in the export command-line options (/stab, /scomma, and so on) the data is now sent to the standard output.
    • Fixed some focus and tab order issues.
  • Version 1.10
    • Added 'Replace' option - Find and replace strings in all records of the NK2 file.
    • Added 'Replace' and 'ReplaceField' script actions - for replacing strings inside the NK2 file by using automatic scripts.
  • Version 1.07
    • Added 'Sort Items By Weight Values' option.
    • Added /copy_default to copy the nk2 file of the default Outlook profile into the specified location. You can use this command-line option in the logon script of every user to create a backup of all NK2 files on the server (For licensed version only)
    • Added /merge_files to merge 2 nk2 files from command-line. (For licensed version only)
  • Version 1.06
    • Fix bug: "The profile name is not valid" error message displayed when using 'Add Records From Mailbox Recipients' and 'Add Records From Address Book' options with Outlook 2010.
  • Version 1.05
    • Added 'Add Records From Mailbox Recipients', which allows you to scan your mailbox, collect email addresses, and merge them into your NK2 file.
  • Version 1.00: First release.

Getting Started With NK2Edit

When you run NK2Edit, it automatically detect the .NK2 file of your default Outlook profile, and open it. If you want to open any other NK2 file, simply go to File->Open .NK2 File (Or press Ctrl+O) and choose the desired NK2 to open.

NK2Edit can work in 2 edit modes:

  • Table Edit Mode: This is the default edit mode, and you should use this mode most of the time. The NK2 records are displayed in simple table. You can double-click a single record to edit the record data. You can also select one or more records, and then delete them, move their location up or download, or copy them and then paste them into another NK2 file.
    In this mode, you can also add new NK2 records by using 'Add New Record' or 'Add New Records From Address Book'.
  • Raw Text Edit Mode: This mode should only be used by advanced users. In this mode, you get a text editor like Notepad, and the NK2 records are provided in structure similar to ini files of Windows. You can also copy the entire text into another text editor that you like, make your changes, and then paste the text back to NK2Edit editor.
The changes you make in both edit modes won't affect the actual NK2 file until you use the 'Save Current NK2 File' option (Ctrl+S). Only when you use the save option, all your changes will be saved into the NK2 file. You can also use the 'Save As' option if you want to save your changes into a new NK2 instead of overwriting the existing one.
As already mentioned, when you overwrite your NK2 file in the first time, NK2Edit automatically creates a backup copy of the original NK2 file with .NK2Edit.First.bak extension.

More Topics...

  • How to purchase commercial license.
  • AutoComplete feature changes on Outlook 2010 and later versions
  • Columns Description of NK2Edit Table Mode
  • NK2Edit Menus Description
  • How to edit NK2 record
  • How to find and replace strings in the NK2 file.
  • How to merge 2 or more NK2 files.
  • How to recover and repair corrupted NK2 files.
  • The Raw Text Edit Mode.
  • NK2Edit command-line options
  • NK2Edit Scripts - Edit NK2 files from command-line.
  • The location of the NK2 file of Outlook.
  • Size limit of Outlook AutoComplete (.NK2) file.
  • Export NK2 AutoComplete records into Outlook Contacts
  • Import addresses from Contacts/Address Book of Outlook into your NK2 file
  • Using NK2Edit in mixed environment of computers running Outlook 32-bit and Outlook 64-bit
  • NK2 Control Center

Support For NK2Edit

If you think that you found a bug in NK2Edit, or you want to request an improvement for future versions, or you have a question about using NK2Edit, you are welcomed to send a message to nk2edit@nirsoft.net
If you already purchased a commercial license, please specify the invoice ID or the registration code inside the message.


AutoComplete feature changes on Outlook 2010 and later versions (Including Outlook 2013)

Outlook 2010 introduced multiple changes in the mechanism of the AutoComplete feature and you should be aware of these changes when using NK2Edit software to edit the AutoComplete files of Outlook 2010.

Here's the list of AutoComplete changes on Outlook 2010:

  • Filename change: In the previous versions of Outlook, the AutoComplete filename was created with .nk2 extension. On Outlook 2010, the filename is created with .dat extension and in the following format: Stream_Autocomplete_0_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.dat
    The xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx section is a random 16-bytes hash.

    On a new Outlook installation or new Outlook profile, the Stream_Autocomplete file is created only after the user sends the first email message. Be aware that NK2Edit cannot edit the Autocomplete data until the Stream_Autocomplete file is created in the first time.

  • In additional to the AutoComplete file stored in the local hard drive, another copy of the AutoComplete data is stored inside the message store of Outlook. For MS-Exchange profile, this copy of the AutoComplete data is stored on the Exchange server. For profile based on .pst file, this copy of the AutoComplete data is stored inside the .pst file.

  • If you delete the local AutoComplete file (with .dat extension) or if the user connects the Exchange server from another computer, the AutoComplete data stored in the Exchange server is automatically copied to the local computer.

  • According to reports of a few customers that use the combination of Outlook 2010 and Exchange Server 2010, sometimes the AutoComplete data stored on the Exchange server randomly overwrites the changes made with NK2Edit. If you experience the same problem, you can overcome this issue by using the /export_to_message_store command-line option:
    NK2Edit.exe /export_to_message_store $default

    This command-line option copies the local AutoComplete .dat file into the message store of the Exchange Server, to ensure that the older AutoComplete data stored inside the Exchange Server will not overwrite the latest changes you make with NK2Edit.

    Starting from version 2.35, you can also export the AutoComplete data to the message store from the user interface, by using the 'Export To Message Store (Outlook 2010)' option (Ctrl+Shift+M)

    Starting from version 2.37, there is an option to automatically export the AutoComplete data to the message store every time that you save the AutoComplete file. In order to activate it, simply check the 'Automatically Export To Message Store' option located under the Options menu. Starting from version 2.65, You can also do it from command-line together with other command-line options, for example:
    NK2Edit.exe /AutoExportToMessageStore 1 /script "f:\scripts\myscript.txt" $default

  • Outlook allows you to delete the AutoComplete cache completely, from both local AutoComplete file and the message store, by using the following command-line option:
    Outlook.Exe /cleanautocompletecache

    When you use the above command-line option, the AutoComplete file is deleted completely, and NK2Edit will not be able to edit the AutoComplete data until the file is created again by Outlook, after the user sends the first message.

  • Suggested Contacts: Outlook 2010 introduced a new feature known as 'Suggested Contacts', which allows the user to manually add items into the AutoComplete combo-box. Be aware that the 'Suggested Contacts' and the older AutoComplete feature are maintained as 2 separated databases. When the AutoComplete combo-box is opened, the emails list is merged from both data sources.

Return to NK2Edit introduction page


Columns Description of NK2Edit Table Mode

  • Index: The position of the record inside the NK2 file. The position of the records also affects the order that the emails are displayed in the drop-down of Outlook. When you click the Index column header, and the table is sorted by the index value, NK2Edit also allows you to move the position of the records up and down (Ctrl+F7 and Ctrl+F8). However, you should be aware that when the user sends a message, the destination email is automatically moved to the first position in the NK2 file.
  • Address Type: Contains the type of the email address: SMTP for regular email addresses, EX for MS-Exchange addresses or FAX for Fax addresses.
  • Display Name: The full name of the user, which is also displayed when an item is chosen from the AutoComplete drop-down. When the name of the user is not available, Outlook put the email address in this field.
    NK2Edit allows you to modify the 'Display Name' by using the 'Edit Selected Record' option (F9).
  • Email/Exchange String: When the address type is 'SMTP', this column contains the email address. When the address type is 'EX' (Exchange), this column contains the exchange address which looks like '/o=First Organization/ou=first administrative group/cn=Recipients/cn=UserName'.
    NK2Edit allows you to modify this field by using the 'Edit Selected Record' option (F9).
  • Drop-Down Name: The name that appears in the drop-down of Outlook AutoComplete. Outlook automatically set this value in a format of 'Display Name <Email Address>'.
    NK2Edit allows you to modify this field by using the 'Edit Selected Record' option (F9), but when the user send an email, Outlook automatically set this value in 'Display Name <Email Address>' format.
  • Search String: When the user type the first letters in the address text-box of Outlook, the 'Search String' value is used to locate the right emails to put in the AutoComplete drop-down. For example, if you have NK2 record with 'abcd' as the search string value, and the user type 'abcd' in the address text-box of Outlook, this NK2 record will appear in the drop-down.
    NK2Edit allows you to modify this field by using the 'Edit Selected Record' option (F9), but when the user send an email, Outlook automatically set this value to the email address or to the MS-Exchange name.
  • Domain: The domain of the SMTP email address. This column allows you to easily sort the records list by the domain of the email address. (Simply click the column header)
  • SMTP Address: Relevant only for Exchange records (Address Type=Ex). Displays the SMTP address of the Exchange account, only if it's stored inside the NK2 record.
  • Display Type: For most NK2 records, this column contains the value of 'Mail User', which is a regular mail account (SMTP or Exchange). For NK2 records which contains a distribution list, this column contains the value of 'Distribution List' or 'Private Distribution List'.
  • Record Weight: Weight value of the record. Records with higher weight values get a better position in the NK2 file when the a message is sent to the email address of the record. Outlook automatically update the weight value according to the popularity of the email address. (Email address that the user send more messages, get higher value)
    Also, Outlook sorts the records in the NK2 file according to this Weight value. The first record (with index no. 1) have the largest Weight value, while the last records have the lowest Weight values (usually 1).
  • Duplicate: Displays a numeric value for records that have identical display name or email address. When you click the Duplicate column header, the NK2 records list is sorted by the duplicate values, and you can find all duplicate records in the top of the list.
  • Sending Format: Specifies the message format that Outlook will use when sending email message to the specified recipient: Automatic (Let Outlook decide...), Outlook Rich Text, or Plain Text. This column is only valid for SMTP records.
    Be aware that if the 'Sending Format' is Outlook Rich Text, the recipient that receives the message will get winmail.dat attachment if he doesn't have MS-Outlook or other email client that supports this message format.
  • EntryID: The Entry ID of the record.
  • Linked To Profile: If the value under this column is Yes, it means that the record is linked to a contact or address book item on your Outlook profile, and it'll stop working if you copy this record into another Outlook profile.
    You can use the 'Remove Link To Outlook Profile' option (Under the Actions menu) to remove the linkage to Outlook profile. This option works only for SMTP records. You cannot remove the linkage to Outlook profile from MAPIPDL records.
To easily understand the meaning of the columns, here's a small image that can help you:
  • Display Name: Marked in the image with blue color.
  • Email/Exchange String: Marked in the image with red color.
  • Drop-Down Name: Marked in the image with green color.


NK2Edit Menus Description

  • File
    • Open .NK2 File: Select the NK2 file to open for editing.
    • New .NK2 File Start a newly empty NK2 file. You can add new records to the new file by using 'Add New Record' or 'Add Records From Address Book' options, or by Copy and Paste from another NK2 file.
    • Backup Current NK2 File: Backup the NK2 that is currently opened. The backup file is saved with the same NK2 filename, but with .NK2Edit.bak extension. For example, if the NK2 filename is Outlook1.NK2, the created backup filename will be 'Outlook1.NK2.NK2Edit.bak'.
    • Restore Last NK2 Backup: Restore from the last backup that was previously created with 'Backup Current NK2 File' option.
    • Restore Backup From First Save: Restore from the backup that was created in the first time that you used NK2Edit with the current NK2 file. Be aware that if you use NK2Edit for long time, this backup might be quite old.
    • Save Current NK2 File: Save and overwrite the existing NK2 file. You should use this option after you made all the changes you need and you want to save them into your NK2 file.
    • Save As: Save into another NK2 file instead of the one that you originally opened.
    • Export To Message Store: Outlook 2010 (and later versions) maintains 2 copies of the AutoComplete data. One copy in the local file system (Stream_Autocomplete_*.dat), and another copy on the message store of your Outlook profile (PST file or Exchange server). This option allows you to copy the local AutoComplete .dat file into the message store of Outlook, to ensure that Outlook will not overwrite your changes.
      Be aware that if you have the x64 build of Outlook 2010 (and later versions), then you must use the x64 version of NK2Edit in order to use this options. For Outlook 2010 32-bit, you have to use the 32-bit version of NK2Edit.
    • Open Default NK2 Folder: Simply open in Explorer the default folder that Outlook uses to save the .NK2 files.
    • Export Selected Items: Allows you to export the selected NK2 records into text files, html files, xml files, and csv files. Be aware that the files created with this export option cannot be converted back into NK2 file.
    • Export Records To Outlook Contacts: Allows you to export the selected NK2 records directly into the contacts of Microsoft Outlook. See also: Export NK2 AutoComplete records into Outlook Contacts
    • New Email To Selected Contacts: Allows you to easily compose a new email message for the selected SMTP addresses. The new message window is opened with your default email program.
    • Open Selected Address In Outlook: Allows you to easily open the selected email address in Outlook. If this email address has an enrty inside the address books of your Outlook profile, this address book entry will be displayed. Otherwise, Outlook will open a simple dialog-box with the display name and email address.
  • Action
    • Edit Selected Record: Simply edit the selected record. When you choose this option, a new dialog-boxed with the selected record is opened, and allows you to modify the values of this record.
    • Add New Record: Add new record according to the display name and email/exchange string that you specify. The search string and drop-down name are automatically filled for you.
    • Add New Records From Address Book: Allows you to add multiple emails from the address book into your NK2 file. This option works only if Outlook is installed properly on your computer.
    • Add Records From Mailbox Recipients: This option allows you to scan your Outlook mailbox, collect the email addresses of all recipients that you sent/received messages in the last xx days, and then merge them into the NK2 file, according to the current merge mode. The email addresses are sorted according to the sent/received time of the message, so the recipients that you sent them messages recently will be added in a better position.
      By default, NK2Edit only scans and adds the email addresses from the messages that you sent. You can also choose to grab email addresses from the received messages, but using this option may also add email addresses of spam/junk messages into your NK2 file.
    • Add Records From Outlook Contacts csv File: This option allows you to add the emails/names stored inside Contacts csv file created by the Outlook Export feature. You can also use contacts file created by other software or email service (like Gmail or Yahoo), as long as the file format is compatible with the Contacts csv file of Microsoft Outlook.
      Be aware that if the email address already exists in your NK2 file, NK2Edit will merge it according to the current merge mode.
    • Add Records From Simple csv File: This option allows you to import addresses from a simple comma-delimited (csv) text file. For more information about the structure of the csv file that can be used with this feature, read this page: Import NK2 addresses from a simple comma-delimited (csv) text file
      Be aware that if the email address already exists in your NK2 file, NK2Edit will merge it according to the current merge mode.
    • Merge With Another NK2 File: This option allows you to easily merge all records from another NK2 file into the currently opened NK2 file.
    • Delete Selected Records: Simply delete the selected NK2 records.
    • Fix Drop-down Name And Search String: Set the Drop-down Name and Search String values for the selected records, according to email and display name values. This feature has the same effect of clicking the AutoFill button in the Edit Record window.
    • Convert EX to SMTP: Converts the selected EX records to SMTP records. This feature works only if the 'SMTP Address' value of the EX record contains the correct SMTP address.
    • Remove Link To Outlook Profile: This option is useful only for SMTP records that are linked to specific Outlook profile (When 'Linked To Profile' column displays 'Yes')
      Records that are linked to specific Outlook profile cannot be used in another Outlook Profile.
      After removing the linkage to Outlook profile, you'll be able to safely copy the record into another AutoComplete file or move the entire AutoComplete file into another Outlook profile.
    • Change Sending Format To: This option allows you to change the message format that Outlook will use when sending a message to the selected SMTP recipients: Automatic (Let Outlook decide...), Outlook Rich Text, or Plain Text.
      Be aware that if the 'Sending Format' is Outlook Rich Text, the recipient that receives the message will get winmail.dat attachment if he doesn't have MS-Outlook or other email client that supports this message format.
    • Move Selected Records Up:
    • Move Selected Records Down: This option only works when the NK2 list is sorted by the index value (You have to click on the 'Index' column header). It moves the selected records up/down to change their position inside the NK2 file. You can use this option to set the order that the NK2 records are displayed in the Drop-Down of Outlook. However, when you send a message from Outlook, Outlook automatically move the sent email to a new position, so the order you set with these options won't persist for long.

      Notice: When you change the order of the NK2 records, it's recommended to set the weight values according to the new records order. You can do it in 2 ways: by resetting all Weight values to 1 (see below) or by using the 'Set All Weight Values By Records Index' option.

    • Sort Index By Drop-Down Name: Sort the NK2 records so they'll appear in alphabetical order inside the drop-down of Outlook. However, be aware that when the user send messages with Outlook, Outlook automatically put the destination email in the top of the NK2 records, and thus sorting the records with this option won't persist for long time.
      Also, if you choose to use this option, it's also recommended to set the weight values according to the new records order. (See the remark for Move Selected Records Up/Down)
    • Sort Items By Weight Values: Sort the NK2 records according to their Weight values. It's recommended to use this option after merging multiple NK2 files into one.
    • Reset All Weight Values to 1: Simply set the weight value of all records to initial '1' value.
    • Set All Weight Values By Records Index: Set the weight value of all records according to the current records index/order. This option can be used after sorting the records with the other options ( 'Move Selected Records Up', 'Move Selected Records Down', and 'Sort Index By Drop-Down Name'), so the weight values of all records will match the records order.
    • Remove Quotes From All Display Names: Sometimes Outlook add unwanted single-quote characters into the display names of the NK2 file. This option allows you to easily remove the unwanted single-quote characters from all records in the currently opened .NK2 file.
  • Edit
    • Find and Find Next: Simply find the desired record according to the text you type. Works on both edit modes.
    • Replace Find and replace strings for selected records or for all records in the NK2 file.
    • Remove Find/Replace Marks Remove the yellow marks of the last Find/Replace activity.
    • Copy: Copy the selected NK2 records to the clipboard. You can use it with combination of 'Paste' menu item to copy NK2 records from one file to another.
    • Copy As Tab Delimited: Copy the selected NK2 records to the clipboard in tab-delimited format. You can use this copy option to paste the NK2 records information into Excel, but you cannot use it to copy records from one .NK2 file to another.
    • Copy As Emails List: Copy the selected NK2 emails to the clipboard as semicolon delimited list that can be used in the To/CC field of Outlook or other email software
    • Copy Emails Only: Copy the selected NK2 emails to the clipboard , each email in a separated line.
    • Paste: Simply paste the records you previously copied.
  • Options
    • Raw Text Edit Mode: Special mode for advanced users that shows the content of the NK2 file in readable text format that looks like the .ini file of Windows.
    • Table Edit Mode: The default mode that shows all NK2 in a table.
    • Merge Mode:
      Determines how Nk2Edit should behave when you try to add an email that already exists in the NK2 records:
      • Always Add New Records: If this option is selected, new emails are always added, even if they already exist, which means that duplicate records might be created.
      • If Email Exists - Overwrite: If this option is selected, and you try to add a new record with email that already exists, your new record will overwrite the existing record with the same email.
      • If Email Exists - Don't Add: If this option is selected, and you try to add a new record with email that already exists, your new record will be discarded.
      The Merge Mode affects the following actions: Copy/Paste, 'Add New Record', and 'Add Records From Address Book', 'Add Records From Mailbox Recipients', 'Add Records From Outlook Contacts csv File'.
    • Automatically Backup On First Save: If this option is selected, NK2Edit automatically creates a backup when you overwrite existing NK2 in the first time.
    • Overwrite Question Before Every Save: If this option is selected, NK2Edit ask you whether you want to overwrite the existing file before any save. If this question is annoying for you, you can turn it off.
    • Ask Before Any Delete: If this option is selected, NK2Edit ask you whether you want to delete records. If this question is annoying for you, you can turn it off.
    • Ask Before Discard Changes: If this option is selected, and you try to exit or open another NK2 file after you made some changes in the current file, NK2Edit will ask you whether you want to discard the changes. If 'Save Question Instead of Discard Question' option is turned on, NK2Edit will ask you whether you want to save your changes.
    • Save Question Instead of Discard Question: If this option is turned on, and you try to exit or open another NK2 file after you made some changes in the current file, NK2Edit will ask you whether you want to save the changes in the current nk2 file. If this option is turned off, NK2Edit will ask you whether you want to discard the changes.
    • Error Messages On File Open: If you turn off this option (By default, it's turned on), NK2Edit won't display error messages when you open corrupted .nk2 file with missing records or other errors.
    • Automatically Export To Message Store: Relevant only to Outlook 2010 or later. If this option is turned on, and you save the default AutoComplete file, NK2Edit will automatically export the saved file to the message store of Outlook (PST file or Exchange)
    • Use SMTP Address In AutoFill Feature: This feature affects the way that NK2Edit automatically fills the Drop-Down Name and the Search String of EX records. If it's turned on, NK2Edit will use the SMTP address to fill the Drop-Down Name and the Search String. If it's turned off, MK2Edit will use the Exchange account name.
      For example: If this option is turned on, the Drop-Down Name will be 'Nir Sofer <nirsofer@nirsoft.net>'. If this option is turned off, the Drop-Down Name will be 'Nir Sofer <NIRS>'.
    • Add Header Line To CSV/Tab-Delimited File: If this option is selected, header line containing the column names is added when you export to csv or tab-delimited file. This option also affects the Control Center window.
    • Mark Duplicate Records: If this option is selected, duplicate records with the same display name or email address are marked with the same color.
    • Associate .nk2 Extension With NK2Edit: If this option is selected, the .nk2 extension inside Windows Explorer is associated with NK2Edit, which means that NK2 files with be displayed with the icon of NK2Edit and when you double-click on NK2 file, it'll be opened with NK2Edit.
      Be aware that this option is irrelevant for Outlook 2010, because Outlook 2010 saves the AutoComplete files with .dat extension instead of nk2 extension. Also, be aware that the file association is made only for the current user (HKEY_CURRENT_USER Registry key)


How to edit existing NK2 record

If you want to edit an existing record, simply select the desired record in the table edit mode, and then double-click with the mouse or press F9. The edit record window will be opened.

The most important fields for editing are the 'Email/Exchange' and 'Display Name'. If the address type is EX (Microsoft Exchange), the 'Email/Exchange' field contains an Exchange address like /o=First Organization/ou=first administrative group/cn=Recipients/cn=Nirs
If the address type is SMTP, the 'Email/Exchange' field contains the email address, like nirsofer@yahoo.com
The 'Display Name' field is simply the name of the recipient, like 'Nir Sofer'.

The 'Drop-Down Name' and 'Search Strings' fields are usually filled automatically by Outlook according to the values in 'Email/Exchange' and 'Display Name' fields. NK2Edit allows you to put any string you like in these fields, but you should be aware that when the user sends an email to this recipient, Outlook automatically reset these fields to the default. If you want to put the defaults of Outlook into The 'Drop-Down Name' and 'Search Strings' fields, simply click the AutoFill button.

The 'Display Type' should be 'Mail User' for most of the NK2 records. For MS-Exchange addresses: if the EX address is a distribution list or a remote user, the appropriate 'Display Type' should be selected.


How to find and replace strings in the NK2 file

NK2Edit allows you to easily find and replace strings in all records of your NK2 file. You can use it, for example, to fix incorrect domain name or incorrect Exchange strings that appear in the NK2 file more than once.
In order to use the 'Replace' option, simply go to Edit->Replace or press Ctrl+P.

In the 'Find/Replace' window, you should fill the string that you want to find, and the new string that you want to place instead of the old one. In the above example, I chose to replace the '@nirsoft.net' domain string to 'softnir.net'.

You can also choose which fields in the NK2 records will be affected by the 'Find/Replace' operation. However, it's recommended to allow NK2Edit to automatically update the Drop-Down Name and the Search String according to the other fields.

After you click the 'Replace All' button, NK2Edit find and replace the strings according to your replace settings, and then displays all modified records in yellow mark, so you can verify that the find/replace operation worked properly.

You can also make an automatic find and replace from a script, without displaying any user interface. For more information: NK2Edit Scripts - Edit NK2 files from command-line.


How to merge 2 or more NK2 files

  1. Run 2 or more instances of NK2Edit, according to the number of NK2 files that you want to merge. In every window of NK2Edit, open the desired NK2 file.
  2. Optionally, you can also run another instance NK2Edit, create a newly empty NK2 file (Ctrl+N), and then merge the other NK2 files into the new one.
  3. In the NK2Edit window containing the source NK2 file, select the records that you want to merge or press Ctrl+A to select all the records. After that, press Ctrl+C to copy the records into the clipboard.
  4. In the NK2Edit window containing the destination NK2 file (it might be an existing NK2 file or a newly empty one), Go to Options->Merge Mode, and choose the desired mode for merging.
  5. Press Ctrl+V (Paste) to add the records that you copied from the other NK2 file.
  6. You can continue to copy and paste more records from other NK2 files.
  7. Starting from version 1.91, you can also copy NK2 records by dragging them from one window to the other.
  8. When you finish to copy all the NK2 records you need, it's recommended to use the 'Sort Items By Weight Values' option (under the Action Menu), so the records will be sorted properly according to the Weight values of the merged records.
  9. Finally, press Ctrl+S to save your changes into the NK2 file.


How to recover and fix corrupted NK2 files

How to recover and fix corrupted NK2 files with NK2Edit

If you have any corrupted NK2 file that Outlook cannot read and the AutoComplete feature doesn't work properly, you can try to open and fix the NK2 by following the instructions below:
  1. Go to File->Open .NK2 File (Ctrl+O) and choose the corrupted NK2 file.
  2. NK2Edit will open the NK2 file and will display all the records found in it. It might also display a warning message about a problem found in the file.
  3. Backup this NK2 file (it's very important !) by using the internal backup of NK2Edit (Ctrl+B) or by manually copying the NK2 into another location.
  4. Browse through all records (in Table Edit Mode) and check if there any record with unusual characters or empty fields. If you found unusual records, simply delete them.
  5. Press Ctrl+S to save the file, and then open Outlook to check whether it can read the NK2 file properly.
  6. If Outlook still cannot read the NK2 file properly, you can try to switch into 'Raw Text Edit Mode', and then locate records with unusual fields that cannot be found with the Table Edit Mode.

There is also another alternative to recover your NK2 file: instead of fixing the previous NK2 file, you can create a new nk2 file, and add the desired email addresses by using 'Add Records From Mailbox Recipients' option. This option automatically scans your mailbox, collect all email addresses that you recently used, and add them into the NK2 file.


The Raw Text Edit Mode

NK2Edit provides a special edit mode that allows you to view and edit the records of NK2 file as a text file that looks like the .ini files of Windows. Every record begins with [record] header, followed by a sequence of lines with 'Property Number=Value' structure. The property number is written as 32-bit hexadecimal number, and the Value is written as string, number or Hex-Dump sequence, depending on the type of the property.

Here's the list of all major properties that you can find in the Raw Text Edit Mode:

Property ID | Type | Name | Description
6001001f | String | Search String | Outlook uses this string for searching the right recipient when the user type the letters in the To/CC text-box. For example, if the value in this field is abcd, and the user type abcd in the recipients text box, this record will be displayed in the drop down. However, you should be aware that Outlook automatically put the email address in this field when the user sends a message.
0c150003 | Integer | Recipient Type | The type of the recipient. 1 = To, 2 = CC, 3 = BCC.
0fff0102 | Binary | EntryID | Unique EntryID of this recipient, in binary format. Generally, you should not modify this value. NK2Edit automatically generate this ID according to the other fields.
300b0102 | Binary | Search Key | Contains a unique search key of this recipient, in binary format. Generally, you should not modify this value. NK2Edit automatically generate this key according to the other fields.
0ffe0003 | Integer | Object Type | The type of the recipient object. 6 = Individual Recipient, 8 = Distribution List Recipient.
39000003 | Integer | Display Type | The display type of the recipient. 0 = Standard mail user, 1 = Distribution List, 5 = Private Distribution List, 6 = Remote User
3003001f | String | Email/Exchange Address | Contains the email address for SMTP records, and MS-Exchange address for EX records.
3002001f | String | Address Type | Contains the address type of the record. SMTP for regular email address, EX for MS-Exchange address, FAX for fax address, and MAPIPDL for private distribution list.
3001001f | String | Display Name | Contains the display name of the recipient.
5ff6001f | String | Recipient Display Name | The original display name of the recipient. This property usually contains the same value as 3001001f.
5ff70102 | Binary | Recipient EntryID | The value of this property is usually identical to 0fff0102.
6003001f | String | Drop-Down Name | The value of this property is displayed in the AutoComplete drop-down,
39fe001f | String | SMTP Address | Contains the SMTP address of Exchange record.
60040003 | Integer | Record Weight | Contains the weight of the record, relative to the other records. Record with higher weight value get a better position in the records list.

What can you do with this edit mode ?

  1. Easily view the content of your NK2 files: NK2 files store the information in binary format that cannot be easily viewed in any text viewer or Hex viewer. This mode allows you to easily view all records and field values stored in your NK2 file.
  2. Find and fix corrupted records or fields: If your NK2 file doesn't work well or doesn't work at all, this mode allows you to locate and fix records with unusual fields and values.
  3. Search and replace in any other editor: With this mode, you can copy the entire text into the clipboard (Ctrl+A and then Ctrl+C) and then paste it into your favourite text editor. In the other editor, you can make changes with search and replace or any other feature that your editor provide. After you made all your changes, simply paste back the text with all your changes (Ctrl+A and then Ctrl+V)

Be Careful !

The raw text edit mode is very powerful, because it allows you to make any change you like, but if you make any mistake, you can easily make the record you edit unreadable by Outlook, and even ruin the entire NK2 and make it unusable. In order to avoid from any risk of losing your NK2 information, always backup your NK2 file before editing it in this mode.


NK2Edit Command-Line Options

/nk2file <Filename> | Start NK2Edit with the specified .NK2 filename. If you don't use this command-line option, the .NK2 file of the default Outlook profile is loaded.
/nk2_to_text <NK2 Filename> <Text Filename> | Convert NK2 file into a raw text file that can be edited with any Unicode text editor. After editing the file, you can convert it back into a valid NK2 file by using /text_to_nk2 command-line option.
/text_to_nk2 <Text Filename> <NK2 Filename> | convert a raw text file back into a valid NK2 file.
/import_full_nk2 <NK2 Filename> | Imports all records of the specified nk2 file into the AutoComplete file of the default Outlook profile. Be aware that this action overwrites all the existing AutoComplete records with the records of the specified nk2 file.
/export_to_message_store <.dat AutoComplete Filename> This command-line option is only relevant for Outlook 2010/2013 and possibly future versions of Outlook. Starting from Outlook 2010, the AutoComplete data is stored in 2 different locations: Inside a simple AutoComplete file on the local disk, like it was in all previous versions of Outlook, and inside the message store where all Outlook data is stored. In MS-Exchange profiles, a copy of the AutoComplete data is stored in the remote Exchange server. In profiles based on .pst file, the AutoComplete data is stored in the .pst file. In some circumstances, the copy of the AutoComplete data stored in the message store of Exchange Server 2010 may overwrite the changes you made with NK2Edit. This command-line option allows you to export the AutoComplete file into the message store of the default Outlook profile, so the copy of the AutoComplete data stored in the MS-Exchange server will not overwrite your changes.

Example:
NK2Edit.exe /export_to_message_store $default

/AutoExportToMessageStore <0 | 1> Specifies whether to automatically export the AutoComplete data into the message store of the default Outlook profile, every time that the AutoComplete is saved. 0 = No, 1 = Yes. You can use this command-line option together with /script and all other command-line options. It's highly recommended to use '/AutoExportToMessageStore 1' if you have Outlook 2010 or greater version.
Be aware that setting AutoExportToMessageStore to 1 only works when you save the default AutoComplete file.
/WarnIfOutlookRunning | You can use this command-line switch with /script , /script_express , and other command-line options to warn the user if Outlook is running.
/CompleteMessage <Message Text> Instructs NK2Edit to display a message to the user when a command-line action is completed, for example:
NK2Edit.exe /CompleteMessage "Finished executing the script of NK2Edit" /LogFile "express_log.txt" /script_express $default 'If AddressType equal "EX" EXToSMTP' 'If Domain Equal "gmail.com" Delete'
/SkipCommandLineNoProfiles If it's set to 1, then the /script, /script_express, and /export_to_message_store commands will not do anything if there are no Outlook profiles on the computer you run it, for example:
NK2Edit.exe /SkipCommandLineNoProfiles 1 /LogFile "express_log.txt" /script_express $default 'If AddressType equal "EX" EXToSMTP' 'If Domain Equal "gmail.com" Delete'
/TimestampBackup | You can use this command-line switch with /script , /script_express , and other command-line options to create a separated backup every time that the command-line is executed. The backup filename is generated with a timestamp, for example: 1.nk2.20130813111927.NK2Edit.bak
/nofirstbackup | By default, /text_to_nk2 and /script options automatically backup the nk2 if it's the first overwrite made by NK2Edit. If you don't want to create a backup, use /nofirstbackup parameter.
/nobackup | By default, /text_to_nk2 and /script options automatically backup the nk2 file on every save, into a filename with .NK2Edit.Cmd.bak extension. If you don't want to create this backup, use /nobackup parameter.
/script <Script Filename> <NK2 Source> <NK2 Destination> Allows you to run a simple script that can make changes, like adding new NK2 records, replacing values in existing records, or deleting unwanted records without displaying any user interface. The <Script Filename> parameter specifies the filename contains the script. The <NK2 Source> is the NK2 filename to load, and the <NK2 Destination> is the NK2 file to save your changes. If <NK2 Destination> is not specified, your changes will overwrite the filename specified in <NK2 Source> parameter.

For more information about scripting with NK2Edit, read this page.

/script_express <NK2 File> 'Script Line 1' 'Script Line 2' 'Script Line 3' ... Allows you to run a simple script, like /script , but without using external script file.

For more information about scripting with NK2Edit, read this page.

/ScriptInput <Input Filename> Allows you to create a script with parameters, and the parameter values are loaded from the specified input file. The input file is comma-delimited (csv) or tab-delimited file. In the script file, a parameter is specified as *X. *0 for the first parameter, *1 for the second paramter, *2 for the third parameter, and so on (up to 10 parameters)

Example for script line with parameters:
if Email Equal "/o=Domain/ou=First Administrative Group/cn=Recipients/cn=*0" set Email "/o=Domain/ou=First Administrative Group/cn=Recipients/cn=*1" AutoFill

Example for the input filename:
user01, newuser01
user02, newuser02
user03, newuser03
user04, newuser04

If you run the above script line with the above input file, /o=Domain/ou=First Administrative Group/cn=Recipients/cn=user01 will be replaced with /o=Domain/ou=First Administrative Group/cn=Recipients/cn=newuser01 and so on..

You can create the input file as Ascii file or Unicode file.

/copy_default <Destination File> (Available only in licensed version)

Allows you to easily copy the NK2 file of the default profile into the specified destination filename. The default NK2 filename may be different from one computer to another, depending on the profile name and Outlook version, so this option provide you an easily way to backup/copy the NK2 file into another location.

You can use this command-line option to collect the NK2 files from all computers on your network, by using it in the logon script of Windows, for example:
NK2Edit.exe /copy_default "z:\nk2files\%computername%.nk2"
NK2Edit.exe /copy_default "z:\nk2files\%username%.nk2"

/RestoreBackup {Backup File Extension} Restores the last backup made by NK2Edit on the default AutoComplete File. By default, this command restores the backup made by NK2Edit scripts, with .NK2Edit.Cmd.bak extension.
Optionally you can specify .NK2Edit.bak extension (backup made from user interface) or NK2Edit.First.bak extension (First backup made by NK2Edit) if you want to restore other type of backup, for example:
NK2Edit /RestoreBackup .NK2Edit.bak
/export_to_contacts <Source NK2 File> (Available only in licensed version)

Allows you to export all emails stored inside the specified NK2 directly into the contacts of Outlook. If an email already exist, it won't be added again, in order avoid from duplicate contacts.
In <Source NK2 File> - you can also specify $default if you want to use the NK2 of the default Outlook profile.

Example:

  • NK2Edit.exe /export_to_contacts "f:\temp\myfile.nk2"
  • NK2Edit.exe /export_to_contacts $default
/generate_new_nk2 <Destination NK2 File> <Number Of Days> <Max Emails> <Sent Messages> <Received Messages> (Available only in licensed version)

Allows you to generate a completely new NK2 file from the email addresses found in your mailbox. When using this command-line option, NK2Edit scans the messages inside your mailbox, collects the email addresses, and then generates a completely new NK2 file with all email addresses found in the mailbox scan process.

Here's the description of the parameters:

  • Destination NK2 File: The NK2 file to save the collected emails list. If you specify $default, the NK2 file of the default Outlook profile will be overwritten.
  • Number Of Days: Specify the number of days to scan backward from the current date. For example: If you specify 60 in this parameter, NK2Edit will scan the email messages created in the last 60 days.
  • Max Emails: Maximum number of email addresses to collect. Be aware that the default maximum number of records in NK2 file is 1000 for Outlook 2003 and 2000 for Outlook 2007/2010. So it's recommended to keep this parameter value below these limits.
  • Sent Messages: Specifies whether to scan the email addresses in the messages you sent. 1 = Yes, 0 = No.
  • Received Messages: Specifies whether to scan the email addresses in the messages you received. 1 = Yes, 0 = No. It's recommended to set this parameter value to 0 in most cases, because when you set it to 1, email addresses of spam messages might be added into the created NK2 file.

Example:

  • Scan the email addresses of messages sent in the last 60 days, and stop the scan process after finding 500 email addresses. Save the found email addresses into myfile.nk2
    NK2Edit.exe /generate_new_nk2 "f:\temp\myfile.nk2" 60 500 1 0

Notice: For using this command-line option with 64-bit version of Outlook 2010, you must use the x64 version of NK2Edit. In all other cases, you should use the 32-bit version of NK2Edit.

/import_address_book <NK2 Filename> <Address Book Name> <Address Type> <MaxRecords> (Available only in licensed version)

Allows you to import the addresses stored inside the Contacts/Address Book of Outlook directly into your NK2 file.

Here's the description of the parameters:

  • NK2 Filename: The NK2 file to import the addresses. If the file already exists, the email addresses from the contacts/address book will be added into the existing NK2 file. If the email addresses already exist in the NK2 file, they'll be merged with the address book emails according to the merge mode defined in the config file. If the specified NK2 file doesn't exist, a completely new NK2 file with all the contacts addresses will be created.
    You can also specify $default for this parameter if you want to use the NK2 file of the default Outlook profile.

  • Address Book Name: The name of the address book to import. You must specify the exact name, as displayed in the address book window of Outlook:

    For non-Exchange Outlook profiles, this parameter should be "Contacts", which means that the email addresses from the Contacts folder of Outlook will be imported into the NK2 file.
    For Exchange profiles, you can also specify other address books, like "Global Address List", "Personal Address Book", "All Users", and a few others.
  • Address Type: Specifies the type of addresses to import. You can specify SMTP (for SMTP addresses), EX (for Exchange addresses), or All (for both SMTP and EX addresses).
    You can also specify multiple address types delimited by '+' character, for example: MAPIPDL+EX+SMTP
  • MaxRecords: Maximum number of records that will be added to the NK2 file. It's recommended to set this value to the default of Outlook, which is 1000 for Outlook 2003, and 2000 to Outlook 2007/2010.

Examples:

  • Add the SMTP addresses from the Contacts of Outlook into the NK2 file of the default Outlook profile:
    NK2Edit.exe /import_address_book $default "Contacts" "SMTP" 2000
  • Add all addresses from the 'Personal Address Book' of Outlook (in Exchange profile) into personal.nk2 file.
    NK2Edit.exe /import_address_book personal.nk2 "Personal Address Book" "All" 2000
  • Add EX, SMTP, and MAPIPDL addresses from 'NirSoft Address Book' into the AutoComplete file of the default Outlook profile:
    NK2Edit.exe /import_address_book $default "NirSoft Address Book" "MAPIPDL+EX+SMTP" 2000

Notice: For using this command-line option with 64-bit version of Outlook 2010, you must use the x64 version of NK2Edit. In all other cases, you should use the 32-bit version of NK2Edit.

/sync_address_book <NK2 Filename> <Address Book Name> <Address Type> <MaxRecords> (Available only in licensed version)

This command line option is very similar to /import_address_book , but with one additional action: /sync_address_book also deletes from the NK2 file all addresses that cannot be found inside the specified address book/contacts list. So if a contact was removed from the address book, it'll also be removed from the NK2 file. Be aware that only the records with the specified Address Type will be removed from the NK2 file. For example, if you specify 'Ex' as the address type, all Exchange emails that cannot be found in the address book will be removed, but the SMTP addresses won't be deleted.

Examples:

  • Synchronize the Exchange addresses in the NK2 file with the Global Address List of Outlook/Exchange, but leave all SMTP records without change.
    NK2Edit.exe /sync_address_book $default "Global Address List" "EX" 2000
/import_csv_file <NK2 Filename> <CSV File> <Merge Mode> (Available only in licensed version)

Allows you to import addresses from a simple comma-delimited (csv) text file. For more information about the structure of this file, read this page: Import NK2 addresses from a simple comma-delimited (csv) text file

Here's the description of the parameters:

  • NK2 Filename: The NK2 file to import the addresses. If the file already exists, the contacts in the specified .csv file will be merged into the nk2 file, according to the specified merge mode. If the file doesn't exist, a new NK2 file will be created. You can also specify $default in order to use the NK2 file of the default Outlook profile.
  • CSV File: The .csv file containing the names/emails information.
  • Merge Mode: Specify one of the following values:
    • 1 - Allow duplicate records
    • 2 - (Recommended) If email already exist, replace it with the new one.
    • 3 - If email already exist, don't add the record.

Examples:

  • NK2Edit.exe /import_csv_file $default "c:\files\users.csv" 3
  • NK2Edit.exe /import_csv_file "c:\temp\1.nk2" "c:\files\users.csv" 2
/import_contacts_file <NK2 Filename> <Contacts File> <Merge Mode> (Available only in licensed version)

Allows you to import addresses from the contacts .csv file of Microsoft Outlook into your .NK2 file. You can create this contacts .csv file by using the export feature of Outlook. Others email software and services, like Gmail and Yahoo, also allows you to export the contacts into a .csv file that is compatible with Microsoft Outlook, so you can also use this command-line option to import contacts of Gmail/Yahoo into your NK2 file.

Here's the description of the parameters:

  • NK2 Filename: The NK2 file to import the addresses. If the file already exists, the contacts in the specified .csv file will be merged into the nk2 file, according to the specified merge mode. If the file doesn't exist, a new NK2 file will be created. You can also specify $default in order to use the NK2 file of the default Outlook profile.
  • Contacts File: The .csv file contains the contacts that you wish to import. This file must be compatible with the contacts export feature of Microsoft Outlook.
  • Merge Mode: Specify one of the following values:
    • 1 - Allow duplicate records
    • 2 - (Recommended) If email already exist, replace it with the new one.
    • 3 - If email already exist, don't add the record.

Examples:

  • NK2Edit.exe /import_contacts_file $default "c:\contacts\mycontacts.csv" 3
  • NK2Edit.exe /import_contacts_file "c:\temp\1.nk2" "c:\contacts\gmail_contacts.csv" 2
/logon_profile <Outlook Profile Name>

This command-line parameter tells NK2Edit to use the specified Outlook profile for any Contacts/Mailbox scan action, instead of using the default profile.
You can use this command-line parameter together with /import_address_book , /export_to_contacts, and /generate_new_nk2 command-line options, if you want to make the action with another Outlook profile. For example, if you want to import the contacts located inside Outlook2 profile into your default NK2 file:
NK2Edit.exe /import_address_book $default "Contacts" "SMTP" 2000 /logon_profile "Outlook2"

/merge_files <Destination File> <Source File 1> <Source File 2> <Merge Mode> <MaxRecords> <Weight Mode> (Available only in licensed version)

Allows you to merge 2 NK2 files into one from command-line. The file you specify in <Source File 2> is merged into <Source File 1> and then the result is saved into the file your specify in <Destination File>. If <Source File 1> or <Source File 2> is specified as an empty string (""), the <Destination File> will be used as a source.

Here's the description of the parameters:

  • Destination File: The .nk2 file to save the final result.
  • Source File 1 and Source File 2: The 2 NK2 files to merge. The file in 'Source File 2' is merged into the file specified in 'Source File 1'. You can specify $default if you want to use the NK2 file of the default profile as a source. You can specify empty string ("") if you want to use the destination file as a source.
  • Merge Mode: Specify one of the following values:
    • 1 - Allow duplicate records
    • 2 - (Recommended) If email already exist, replace it with the new one.
    • 3 - If email already exist, don't add the record.
  • MaxRecords: Maximum number of records that will be added to the NK2 file. It's recommended to set this value to the default of Outlook, which is 1000 for Outlook 2003, and 2000 to Outlook 2007/2010.
  • Weight Mode: Determines how to handle the Weight value and records order after the files are merged. You can specify one of the following values:
    • 0 - Don't change anything.
    • 1 - Set the Weight value of all records to 1 (initial value).
    • 2 - (Recommended) Sort the records according to the Weight value of the merged records.

Examples:

  • Merge file2.nk2 into file1.nk2 with maximum limitation of 2000 records.
    NK2Edit.exe /merge_files "f:\temp\file1.nk2" "" "f:\temp\file2.nk2" 2 2000 2
  • Merge the NK2 file of the default profile into merged.nk2, without records limitation (MaxRecords = 0). You can put this line in a logon script and create a large NK2 file which contains the NK2 records of all users...
    NK2Edit.exe /merge_files "z:\nk2data\merged.nk2" "" $default 2 0 2
  • Merge existing nk2 file with important records into the NK2 file of the default profile.
    NK2Edit.exe /merge_files $default "" "z:\records.nk2" 2 1000 2
  • Merge 1.nk2 into 2.nk2 and then save the result into 3.nk2
    NK2Edit.exe /merge_files "3.nk2" "2.nk2" "1.nk2" 2 1000 2
/ccenterfile <Filename> | Specifies the Control Center information file (nk2info.dat) to load into the Control Center.
/ccenter Export the Control center table into a csv/html/xml file, without displaying any user interface. This parameter should be used with one of the export command-line option: /stext , /stab, /scomma , /stabular , /shtml , /sverhtml , /sxml
For example:
NK2Edit.exe /ccenter /shtml "c:\temp\ccenter.html"
NK2Edit.exe /ccenter /shtml "c:\temp\ccenter.html" /sort "Records Count"
NK2Edit.exe /ccenter /scomma "c:\temp\ccenter.csv" /sort "Records Count" /ccenterfile "f:\temp\nk2info.dat"

/open_control_center | Opens the NK2 Control Center window, in addition to the main NK2 editor window.
/load_config <Filename> When you use this command-line option, NK2Edit will load the configuration from the specified filename, instead of using the default nk2edit.cfg located in the same folder of nk2edit.exe
When you exit from NK2Edit, the configuration will be saved to the same filename that you specified.

Example:
NK2Edit.exe /load_config "c:\myconfig\1.cfg"

/add_nk2_associate | Associate the .nk2 extension with NK2Edit.
/remove_nk2_associate | Remove the .nk2 association with NK2Edit.
/LogFile <Log Filename> This command-line option can be used with /script , /import_address_book , /export_to_contacts, /sync_address_book, /generate_new_nk2, /import_csv_file, and other command-line options. It creates a log file with information about any action made by NK2Edit and information about error occurred during the process.

Examples:
nk2edit.exe /logfile "import_address_book_log.txt" /import_address_book "contacts.nk2" "Contacts" "All" 2000
NK2Edit.exe /logfile "export_to_contacts_log.txt" /export_to_contacts $default
NK2Edit.exe /logfile "generate_new_nk2_log.txt" /generate_new_nk2 "generate_new.nk2" 500 500 1 0

/LogFileAppend <Log Filename> This command-line option is similar to the /LogFile command-line option. As opposed to the /LogFile command-line option that overwrites the log file if it already exists, this command-line options appends the new log lines to the end of the existing file.

Examples:
nk2edit.exe /LogFileAppend "import_address_book_log.txt" /import_address_book "contacts.nk2" "Contacts" "All" 1000
NK2Edit.exe /LogFileAppend "export_to_contacts_log.txt" /export_to_contacts $default
NK2Edit.exe /LogFileAppend "generate_new_nk2_log.txt" /generate_new_nk2 "generate_new.nk2" 200 200 1 0

/CurrDirExe Changes the current directory used for all other command-line options.
By default, when you specify a filename without a path (For example: NK2Edit.exe /script "myscript.txt" $default ""), NK2Edit searches the file in the current directory returned by Windows operating system. In most cases, the current directory is where the .exe file of NK2Edit is located, but in some other cases (For example, when running NK2Edit from RunOnce Registry key), the current directory might be different.
If /CurrDirExe is specified, NK2Edit will search the file in the same folder where NK2Edit.exe is located, even if the current directory of Windows operating system is different.

Example:
nk2edit.exe /CurrDirExe /script "myscript.txt" $default ""

In the above example, myscript.txt will be loaded from the folder of nk2edit.exe, even if the current directory of Windows points to another location.

/stext <Filename> | Export the list of all AutoComplete entries into a simple text file.
/stab <Filename> | Export the list of all AutoComplete entries into a tab-delimited text file.
/scomma <Filename> | Export the list of all AutoComplete entries into a comma-delimited text file.
/stabular <Filename> | Export the list of all AutoComplete entries into a tabular text file.
/shtml <Filename> | Export the list of all AutoComplete entries into HTML file (Horizontal).
/sverhtml <Filename> | Export the list of all AutoComplete entries into HTML file (Vertical).
/sxml <Filename> | Export the list of all AutoComplete entries to XML file.
/soutlook <Filename> | Export the list of all AutoComplete entries into a tab-delimited text file that can be used to import the emails/names list into the contacts of Outlook.
/ssimplecsv <Filename> | Export the list of all AutoComplete entries into a simple comma-delimited file (csv) containing only the display name, email address, and address type. You can use the created file with 'Add Records From Simple csv File' option to import the addresses into another NK2 file.
/sort <column> This command-line option can be used with other save options for sorting by the desired column. If you don't specify this option, the list is sorted according to the last sort that you made from the user interface. The <column> parameter can specify the column index (0 for the first column, 1 for the second column, and so on) or the name of the column, like "Email" and "Display Name". You can specify the '~' prefix character (e.g: "~Display Name") if you want to sort in descending order. You can put multiple /sort in the command-line if you want to sort by multiple columns.

Examples:
nk2edit.exe /shtml "f:\temp\nk2.html" /sort 2 /sort ~1
nk2edit.exe /shtml "f:\temp\nk2.html" /sort "~Type" /sort "Email"

/nosort | When you specify this command-line option, the list will be saved without any sorting.

More Command-Line Options

The following command-line options can be used to override the configuration loaded from the nk2edit.cfg file:
/AutoBackupOnFirstSave <0 | 1> | Automatically Backup On First Save. 0 = No, 1 = Yes.
/OverwriteQuestion <0 | 1> | Overwrite Question Before Every Save. 0 = No, 1 = Yes.
/DeleteQuestion <0 | 1> | Ask Before Any Delete. 0 = No, 1 = Yes.
/DiscardChangesQuestion <0 | 1> | Ask Before Discard Changes. 0 = No, 1 = Yes.
/ShowErrorMessagesOnOpen <0 | 1> | Error Messages On File Open. 0 = No, 1 = Yes.
/AddExportHeaderLine <0 | 1> | Add Header Line To CSV/Tab-Delimited File. 0 = No, 1 = Yes.
/UseAddressBookDefaultProfile <0 | 1> | Use Address Book Of Default Profile. 0 = No, 1 = Yes.
/MarkDuplicateRecords <0 | 1> | Mark Duplicate Records. 0 = No, 1 = Yes.
/UseSaveQuestion <0 | 1> | Save Question Instead of Discard Question. 0 = No, 1 = Yes.
/EditMode <1 | 2> | Edit Mode. 1 = Raw Text Edit Mode, 2 = Table Edit Mode
/MergeMode <1 | 2 | 3> | Merge Mode. 1 = Always Add New Records, 2 = If Email Exists - Overwrite, 3 = If Email Exists - Don't Add.
/ExportCharEncoding <0 | 1 | 2 | 3> | Specifies the characters encoding that will be used in the following export command-line options: /scomma , /stext , /shtml , /sverhtml , /sxml , /stab , /stabular , /soutlook , /ssimplecsv 0 = Default, 1 = UTF-8, 2 = UTF-16, 3 = Ascii


Edit NK2 files from command-line.

NK2Edit allows you to write small and simple scripts that can add/modify/delete records in .NK2 files, and execute them from command-line, without displaying any user interface.

NK2Edit Script Features

  • NK2Edit scripts can be executed in the logon script of any computer (Starting from Windows 2000) without need of any installation.
  • NK2Edit scripts allow you to automatically remove specific types of NK2 records. For example, you can choose to remove all SMTP addresses, or you can choose to remove all SMTP addresses with specific domain.
  • NK2Edit scripts allow you to automatically fix common errors and problems that occurred in the NK2 files of all users in your organization. For example, if there was a change in any email address or in the MS-Exchange addresses, and the addresses stored in the NK2 are now invalid, simply create a script that modifies the old addresses to the new addresses, and the problem will be solved for all users at once.
  • NK2Edit scripts can also fix corrupted NK2 files: When NK2Edit script modifies the NK2 file, it also rebuilds the entire file and removes errors found in it, so if there is any problem in the NK2 file and Outlook cannot load it, there is a good chance that the problem will be solved after running the NK2 script.

Getting Started

A script can be executed from command-line by using /script parameter:
NK2Edit.exe /script <Script Filename> <NK2 Source> <NK2 Destination>

The <Script Filename> parameter specifies the filename contains the script commands. The <NK2 Source> is the NK2 filename to load, and the <NK2 Destination> is the NK2 file to save your changes. If <NK2 Destination> is not specified or you specify an empty string (""), your changes will overwrite the filename specified in <NK2 Source> parameter.
You can use /LogFile parameter in order diagnose problems with your script. When you use the /LogFile parameter, all actions made by the script are saved into the specified text file.

For NK2Edit with commercial license: You can also specify $default instead of the NK2 filename. When $default is specified, NK2Edit uses the NK2 file of the default Outlook profile, in the context of the user that executes the script.

Examples:
NK2Edit.exe /script "f:\scripts\myscript.txt" "C:\Documents and Settings\Administrator\Application Data\Microsoft\Outlook\Outlook.NK2"
NK2Edit.exe /script "f:\scripts\myscript.txt" "C:\Documents and Settings\Administrator\Application Data\Microsoft\Outlook\Outlook.NK2" "c:\temp\mynewfile.nk2"
NK2Edit.exe /script "f:\scripts\myscript.txt" $default
NK2Edit.exe /script "f:\scripts\myscript.txt" $default "" /LogFile "f:\%computername%.txt"
NK2Edit.exe /script "f:\scripts\myscript.txt" "C:\Documents and Settings\Administrator\Application Data\Microsoft\Outlook\Outlook.NK2" "" /NoBackup /LogFile "f:\mylog.txt"

Starting from version 2.65, you can also use /script_express command-line option, which allows you to run a script without using external script file:
NK2Edit.exe /script_express <NK2 File> 'Script Line 1' 'Script Line 2' 'Script Line 3' ...

When using /script_express, every script line must be delimited with single-quote characters and you should not add any other command-line options after the script lines. All other command-line options must precede the /script_express command-line option.

Examples:
NK2Edit.exe /LogFile "express_log.txt" /script_express $default 'If AddressType equal "EX" EXToSMTP' 'If Domain Equal "gmail.com" Delete'
NK2Edit.exe /LogFile "express_log.txt" /AutoExportToMessageStore 1 /script_express $default 'If AddressType equal "EX" EXToSMTP'
NK2Edit.exe /script_express "mynk2.nk2" 'If Domain Equal "gmail.com" Delete' 'If Domain Equal "yahoo.com" Delete' 'If Domain Equal "hotmail.com" Delete'

Currently, the scripts of NK2Edit support the following commands:

  • If - Allows you to remove and modify existing records according to the specified condition.
  • Add - Allows you add new records, by specifying address type, name, and email/Exchange string.
  • MergeMode - Specifies the merge mode for Add command.
  • RemoveQuotes - Removes the single-quotes from the display names and drop-down names in all NK2 records.
  • RemoveDoubleQuotes - Removes double-quotes from the display names and drop-down names in all NK2 records.

It's possible that more commands will be added in the future according to customer's requests.

Automatic Backups

When editing NK2 file using a script, NK2Edit automatically creates 2 types of backups:
  • First Time Backup: This backup is created only in the first time that NK2Edit overwrite existing NK2 file. The backup file is saved with .NK2Edit.First.bak extension. If you don't want that this backup will be created, use /nofirstbackup command-line option.
  • Every Save Backup: This backup is created on every time that changes are made into existing NK2 file. The backup file is saved with .NK2Edit.Cmd.bak extension. If you don't want that this backup will be created, use /nobackup command-line option.

It's highly recommended to allow NK2Edit to backup the NK2 files, unless you maintain your own backup system. Making backups for NK2 files insure that if something goes wrong with your scripts, you'll be able to restore the original NK2 file.

General guidelines for NK2Edit scripts

  • The script commands are not case sensitive.
  • You can edit the script with notepad or any other text editor and then save it to Ascii or Unicode text file. If you have non-English characters in your script, it's recommended to save the file as Unicode.
  • You must write every command in separated line.

Using the 'If' command

The general syntax of 'If' command is:
If [FieldName] [Operator] [Value] [Action]

The [FieldName] may specify the following fields: AddressType, DisplayName, Email, DropDown, SearchString, Domain, DisplayType, Weight, SMTPEmail (SMTP email For Exchange records only), and EmailString. For DisplayType field, you can specify one of the following numeric values: 0 for Mail User, 1 for Distribution List, 5 for Private Distribution List, and 6 for Remote User.
The EmailString field (Added in version 2.95) is a combination of Email and SMTPEmail fields, which means that it returns the correct email address string for both SMTP and Exchange records.

The [Operator] may specify the following values: Contain, Equal, BeginWith, EndWith, NotContain, NotEqual, NotBeginWith, NotEndWith, Like, LengthRange, IsNumber. For Weight and DisplayType fields, the following operators also available: GreaterThan, LessThan.

The [Action] may contain one of the following actions to perform on the records:

  • Delete - Delete the record
  • NoDelete - Mark the record for 'no delete', so the record won't be deleted even if other 'if' command request to delete it.
  • Set [FieldName] [Value] - Set a value into the specified string. [FieldName] may also contain 'weight' string, if you want to set the weight of the NK2 record. [FieldName] may also contain 'SendingFormat' string, if you want to set the sending format. For 'SendingFormat' field, you can use the following values:
    • 0 - Send using Outlook Rich Text Format
    • 1 - Let Outlook decide the best sending format
    • 7 - Send Plain Text Only
  • Replace [Find String] [Replace String] - Replace a string with a new string in all major fields.
  • ReplaceField [FieldName] [Find String] [Replace String] - Replace a string with a new string only in the specified field.
  • ReplaceCS [Find String] [Replace String] - The same as Replace action, but the find string is case sensitive.
  • ReplaceFieldCS [FieldName] [Find String] [Replace String] - The same as ReplaceField action, but the find string is case sensitive.
  • AutoFill - Automatically fill the DropDown Name and Search String of the record with the right values. It's recommended to use this action after Set or ReplaceField actions.
  • EXToSMTP - Automatically convert EX record into SMTP record. This action only works if the NK2 record stores the correct SMTP address of the EX record. (You can look at the 'SMTP Address' column of the EX record. If it's empty, it means that you cannot use the EXToSMTP action)
  • RemoveLinkToProfile - This action removes the link to profile of SMTP addresses. This action is only relevant for SMTP records with 'Yes' value on the 'Linked To Profile' column.
Here's some examples for using If command:
  • Put all emails with @mydomain.com domain at the top of the AutoComplete list, by giving them very high weight value:
    if EmailString Contain "@mydomain.com" set weight 1000000
  • Delete all non-private distribution lists:
    if DisplayType Equal 1 delete
  • Delete all SMTP addresses:
    If AddressType equal "SMTP" Delete
  • Delete all Exchange addresses:
    If AddressType equal "EX" Delete
  • Delete all records that their display name contains 0 - 7 characters:
    If DisplayName LengthRange 0-7 Delete
  • Delete all SMTP addresses except of email addresses of hotmail.com and msn.com: (The NoDelete command overrides the delete command)
    If AddressType equal "SMTP" Delete
    If Email Contain "@hotmail.com" NoDelete
    If Email Contain "@msn.com" NoDelete
  • Delete all records that their domain name is gmail.com :
    If Domain Equal "gmail.com" Delete
  • Delete all records that their email address ends with .co.uk
    If EmailString EndWith ".co.uk" Delete
  • Delete all records begins with 'support' and ends with .net
    if EmailString Like "support*@*.net" delete
  • Switch from specific MS-Exchange email to SMTP email address:
    if Email Equal "/o=First Organization/ou=first administrative group/cn=Recipients/cn=Nirs" Set Email "smtp_email@nirsoft.net" Set AddressType "SMTP" AutoFill
  • Switch all MS-Exchange addresses to SMTP email addresses automatically:
    If AddressType equal "EX" EXToSMTP
  • Set the sending format of all SMTP addresses to automatic (Let Outlook decide the best sending format)
    If AddressType equal "SMTP" Set SendingFormat 1
  • Find the record with aaaaa@msn.com as email address, and change it to helloworld@msn.com as email and 'Hello World' as display name. Also, fill the appropriate values in the DropDown and Search string (AutoFill) .
    If Email Equal "aaaaa@msn.com" Set Email "helloworld@msn.com" Set DisplayName "Hello World" AutoFill
  • Find the record with support@nirsoft.net as email address and delete it:
    If EmailString Equal "support@nirsoft.net" Delete
  • Find all Exchange records (AddressType="EX") and change their address to a new server:
    If AddressType equal "EX" ReplaceField "Email" "/o=First Organization/ou=first administrative group" "/O=NirSoft Organization/OU=NirSoft"
  • Find all SMTP email addresses with @domain1.com and change their domain to @domain2.com
    Also, update the DropDown and Search strings according to the email address change (AutoFill).
    If AddressType equal "SMTP" ReplaceField "Email" "@domain1.com" "@domain2.com" AutoFill
  • Replace 'NirSoft' string to 'SoftNir' in all SMTP records. This change will affect all major fields, including the display name and the email address.
    If AddressType equal "SMTP" Replace "NirSoft" "SoftNir"
  • Delete all records that their search string is a number:
    If SearchString IsNumber Delete

Using the 'Add' command

The general syntax of 'Add' command is:
Add [Address Type] [Email/Exchange String] [Display Name] {Display Type}

The {Display Type} is optional parameter that may contain the following values: 0 for standard mail user (default), 1 for distribution list, and 6 for remote user

Examples for using Add command:

  • Add "SMTP" "nirsofer@yahoo.com" "Nir Sofer"
  • Add "EX" "/o=First Organization/ou=first administrative group/cn=Recipients/cn=Nirs" "Nir Sofer"
  • Add "EX" "/o=First Organization/ou=first administrative group/cn=Recipients/cn=everyone" "Everyone" 1

If the Email address or Exchange account already exist, the MergeMode is used to determine whether to add the record, replace it with the old one, or discard it.

Using the 'MergeMode' command

The general syntax of 'MergeMode' command is:
MergeMode [Mode Number]

Examples for using MergeMode command:

  • Specifies that the Add command should always add the record, even if it already exist (duplicates might be created):
    MergeMode 1
  • Specifies that if the email already exists, the Add command should replace it with the new one:
    MergeMode 2
  • Specifies that if the email already exists, the Add command should not add the record:
    MergeMode 3

Script example with all commands

if AddressType Equal "SMTP" Delete
if Email Contain "@hotmail.com" NoDelete
if Email Contain "@msn.com" NoDelete
if Email Equal "abcdefg@msn.com" Set Email "helloworld@msn.com" Set DisplayName "Hello World"
MergeMode 2
Add "SMTP" "nirsofer@yahoo.com" "Nir Sofer"
Add "SMTP" "abcdefg@hotmail.com" "abcdefg"
Add "EX" "/o=First Organization/ou=first administrative group/cn=Recipients/cn=Nirs" "Nir Sofer"
Add "EX" "/o=First Organization/ou=first administrative group/cn=Recipients/cn=everyone" "Everyone" 1
If AddressType equal "EX" ReplaceField "Email" "/o=First Organization/ou=first administrative group" "/O=NirSoft Organization/OU=NirSoft"
If AddressType equal "SMTP" ReplaceField "Email" "@domain1.com" "@domain2.com" AutoFill
If AddressType equal "SMTP" Replace "NirSoft" "SoftNir"
RemoveQuotes

Script With Parameters

Starting from version 1.85, you can also create a script with parameters that are loaded from comma-delimited (csv) or tab-delimited text file.
In the script file, a parameter is specified as *X. *0 for the first parameter, *1 for the second parameter, *2 for the third parameter, and so on (up to 10 parameters).
The parameters file (input file) is specified with the /ScriptInput command-line option.

For example, you can create a script with the following script line:
if Email Equal "/o=Domain/ou=First Administrative Group/cn=Recipients/cn=*0" set Email "/o=Domain/ou=First Administrative Group/cn=Recipients/cn=*1" AutoFill

In the input file, you specify the 2 parameters for every line, delimited by comma (You can also use tab-delimited file, NK2Edit automatically detects the file type):
user01, newuser01
user02, newuser02
user03, newuser03
user04, newuser04

In order the execute the script with the input file, use both /ScriptInput and /script command-line option:
NK2Edit.exe /ScriptInput "inputfile.txt" /script "f:\scripts\myscript.txt" $default ""

In the above example, NK2Edit will execute the specified script line 4 times, each time with different parameters values taken from the input file. So it's exactly like executing the following 4 script lines:
if Email Equal "/o=Domain/ou=First Administrative Group/cn=Recipients/cn=user01" set Email "/o=Domain/ou=First Administrative Group/cn=Recipients/cn=newuser01" AutoFill
if Email Equal "/o=Domain/ou=First Administrative Group/cn=Recipients/cn=user02" set Email "/o=Domain/ou=First Administrative Group/cn=Recipients/cn=newuser02" AutoFill
if Email Equal "/o=Domain/ou=First Administrative Group/cn=Recipients/cn=user03" set Email "/o=Domain/ou=First Administrative Group/cn=Recipients/cn=newuser03" AutoFill
if Email Equal "/o=Domain/ou=First Administrative Group/cn=Recipients/cn=user04" set Email "/o=Domain/ou=First Administrative Group/cn=Recipients/cn=newuser04" AutoFill

When executing the script, the nk2 record with /o=Domain/ou=First Administrative Group/cn=Recipients/cn=user01 will be replaced with /o=Domain/ou=First Administrative Group/cn=Recipients/cn=newuser01 , nk2 record with /o=Domain/ou=First Administrative Group/cn=Recipients/cn=user02 will be replaced with /o=Domain/ou=First Administrative Group/cn=Recipients/cn=newuser02, and so on...


The location of the NK2 file of Outlook

The location of the NK2 AutoCompelete file created by Outlook might be different from one computer to another, depending on the operating system and the version of Outlook.
Here's the rules for finding the location of your NK2 file:
  • For Outlook 2003/2007 with Windows 2000, Windows XP, or Windows Server 2003:
    The location of the nk2 file is C:\Documents and Settings\[User Profile]\Application Data\Microsoft\Outlook
    The name of the NK2 file is identical to the Outlook profile name, with .nk2 extension.

  • For Outlook 2003/2007 with Windows Vista, Windows 7, or Windows server 2008:
    The location of the nk2 file is C:\Users\[User Profile]\AppData\Roaming\Microsoft\Outlook
    The name of the NK2 file is identical to the Outlook profile name, with .nk2 extension.

  • For Outlook 2010/2013 with Windows Vista, Windows 7, or Windows server 2008:
    The nk2 file is located in C:\Users\[User Profile]\AppData\Local\Microsoft\Outlook\RoamCache
    The name of the NK2 file is in the following format: Stream_Autocomplete_X_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.dat The X is the file index (usually 0) and AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA is a random 16-byte key in hexadecimal format.

  • For Outlook 2010/2013 with Windows XP:
    The nk2 file is located in C:\Documents and Settings\[User Profile]\Local Settings\Application Data\Microsoft\Outlook\RoamCache
    The name of the NK2 file is in the following format: Stream_Autocomplete_X_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.dat The X is the file index (usually 0) and AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA is a random 16-byte key in hexadecimal format.

When you use the NK2Edit utility, you don't have to worry about locating the NK2 filename, because NK2Edit automatically open the default NK2 file for you.


Size limit of Outlook AutoComplete file (.NK2)

By default, MS-Outlook limits the number of records that are allowed to be added into the AutoComplete (nk2) file.
For Outlook 2003 - The maximum number of AutoComplete records is 1000.
For Outlook 2007 and Outlook 2010 - The maximum number of AutoComplete records is 2000.

If you want to modify the maximum records limit, you can do it by adding a new key and value into the Registry key of Outlook.
For Outlook 2003, The maximum records value is located in the following key/value:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\AutoNameCheck]
"MaxNicknames"=dword:000003e8
In the above example, the MaxNicknames value is set to 0x3e8 (1000 records), but you can increase or decrease it to any value you want. In order to easily add this key, simply select above Registry text, copy it to the clipboard, paste it into a text editor, and then save it as Unicode file with .reg extension. The created .reg file can be used to easily import this Registry key/value into the Registry.

For Outlook 2007, The maximum limit value is located in the following Registry key/value:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\AutoNameCheck]
"MaxNicknames"=dword:000003e8

For Outlook 2010, The maximum limit value is located in the following Registry key/value:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\AutoNameCheck]
"MaxNicknames"=dword:000003e8


Export NK2 AutoComplete records into Outlook Contacts

NK2Edit allows you to easily exports email addresses from the NK2 file directly into the contacts of Microsoft Outlook. In order to use this feature, simply select the desired NK2 records in the main window of NK2Edit, and then go to File->Export Records To Outlook Contacts or simply press Ctrl+F9.

NKEdit will ask whether you want to exports the selected NK2 records into your contacts folder. If you choose 'Yes', the selected email addresses will be added into your Outlook contacts list. Be aware that if an email address already exist in your contacts, NK2Edit won't add it, in order to avoid from duplicate records in the Contacts folder.

Also, be aware that if you use the 64-bit version of Outlook 2010, you must use the x64 version of NK2Edit for working with this feature. In all other cases, you should use the 32-bit version of NK2Edit.


Import addresses from Contacts/Address Book of Outlook into your NK2 file

NK2Edit allows you to easily import the email addresses stored in the address book of Outlook directly into your NK2 file.

In order to use this feature, go to Action->Add Records From Address Book, or simply press Ctrl+F6. The address book window of Outlook will be displayed:

In the 'Search' section, you should choose 'Name Only' to view all addresses, or alternatively, choose 'More Columns' and then type a search string.
In the 'Address Book' combo-box, you should choose the desired address book. For non-Exchange profiles, you can only choose 'Contacts'. For Exchange profiles, other address books may also be available, like 'Global Address List' and 'Personal Address Book'.

After choosing the desired address book, you can select multiple addresses to add into your NK2 file, by holding down the Shirt or Ctrl key and selecting the desired addresses with the UP/Down arrow keys.

You should press the 'To' button in order to add the selected addresses to the list.

After that, press the 'Ok' button, and then the addresses list will be added into your current NK2 file:

In the licensed version, you can also import addresses from the address book of Outlook automatically, by using /import_address_book command-line option. For more information about using this command-line option, see: NK2Edit command-line options

Notice: If you want to use this feature with the Outlook 2010 64-bit, you must use the x64 version of NK2Edit. In all other cases, you should use the 32-bit version of NK2Edit.


NK2 Control Center

About NK2 Control Center

NK2 Control Center is a special module in NK2Edit utility that allows you to view the location and status of all NK2 AutoComplete files in your organization. In order to use this feature, you must add a single line into the logon script of every Outlook user. This script command is responsible for collecting the NK2 location and other information and saving it into one file.

Advantages of using NK2 Control Center

  • Automatically detect corrupted NK2 files that stopped working with Outlook, even if the users don't complain about that.
  • If you have admin access to the computers on your network (like \\compname\c$), you can easily open the NK2 file of every user with a single click. You don't have to search the location of the NK2 file.
  • Allows you to easily watch the summary of all NK2 files in your company, including the number of records of every NK2 file, the number of SMTP records, the number of MS-Exchange records, the size of the NK2 file, the full path of the NK2 filename, and the Outlook profile name.

Control Center License

The number of computers that you can view with NK2 Control Center is restricted according to the number of Outlook workstations in your license. For example, if you purchased 50 Workstations license, you are allowed to view up to 50 different computers.

NK2Edit without a commercial license allows you to watch up to 10 different computers.

Getting Started

In order to start using NK2 Control Center, you must add the following line into the logon script of every user:
NK2Edit.exe /saveinfo

The NK2Edit.exe should be located in a shared network folder that can be accessed by all users. When this command is executed, NK2Edit creates a file named 'nk2info.dat' in the same folder of NK2Edit.exe
If the users don't have write permission in the folder where NK2Edit is located, you must specify a filename in a shared network folder that every user has a write permission for it, for example:
NK2Edit.exe /saveinfo "G:\NK2Edit\nk2info.dat"

After adding this line, wait until the users make the next log-on, and then run NK2Edit and start the Control Center by pressing F2 key.
By default, the Control Center tries to read the nk2info.dat located in the same folder of NK2Edit. If you saved the file in another location, you have to manually select the file by using the 'Choose nk2info.dat' button.

If you have full admin share access to the remote computer on your network (\\computer\c$), you can easily open any file from the Control Center by using the 'Open Selected NK2 File' option (Ctrl+O).

Control Center Columns

  • Computer: The name of the computer.
  • User Name: The name of the user in a format of Domain\User.
  • Outlook Profile: The name of the default Outlook profile for the specified user.
  • Updated On: The date/time that the /saveinfo was executed.
  • Status: The status of NK2 file. This column may contain the following values:
    • File is Ok - This status is displayed when NK2Edit managed to read the NK2 file properly without any problem.
    • File contains unrecognized bytes - This status is displayed when NK2Edit managed to read all records, but some bad or unrecognized bytes were found in the file.
    • Record count mismatch - This status is displayed when the number of records found in the file ('Records Found' column) is different from records counter stored in the NK2 header ('Records Count' column).
    • Failed to read the file - This status is displayed when NK2Edit failed to read the NK2 file due to permission problem or any other file access issue.

    When the file status is not 'File is Ok', you should check whether the AutoComplete feature works properly in the specified workstation. If the AutoComplete feature doesn't work, you can fix it by following the NK2 file repair instructions. Be aware that after you repair the file, the status displayed on the Control Center won't be changed until the next update of the logon script.

  • Filename: The full-path filename of the NK2 file.
  • Records Count: The number of records according to the header of the NK2 file.
  • Records Found: The number of records found inside the NK2 file.
  • SMTP Records: The number of SMTP records found inside the NK2 file.
  • Exchange Records: The number of Exchange records found inside the NK2 file.
  • File Size: The size of the NK2 file.
  • Remote Network File:The path to access the NK2 file from another computer on your network. You must have admin access to use this path.


Using NK2Edit in mixed environment of computers running Outlook 32-bit and Outlook 64-bit

Due to limitations of the programming interfaces provided by Microsoft Outlook, some of the features of NK2Edit, like importing records from the address book, requires to run the correct build of NK2Edit according to the installed build of Outlook. NK2Edit 32-bit for 32-bit version of Outlook, and NK2Edit 64-bit for 64-bit version of Outlook.

In order to make easier life for organizations with mixed environment of computers running Outlook 32-bit and computer running Outlook 64-bit, version 2.70 of NK2Edit introduces new package containing both 32-bit and 64-bit executables, and a third executable file that runs the correct build according to the installed build of Outlook.

The new package contains the following executable files:

  • nk2edit_32_bit.exe - 32-bit executable of NK2Edit
  • nk2edit_64_bit.exe - 64-bit executable of NK2Edit
  • NK2Edit.exe - Small executable file that checks the installed build of Outlook in the Registry and automatically executes the needed version of NK2Edit - nk2edit_32_bit.exe or nk2edit_64_bit.exe
Here's the instructions for using this mixed 32-bit/64-bit package:
  • You must copy all 3 executables to the same folder.
  • You should only directly run NK2Edit.exe and allow it to execute the correct build of NK2Edit (nk2edit_32_bit.exe or nk2edit_64_bit.exe).
  • You can freely run NK2Edit.exe with any command-line option you need, and it'll automatically transfer all command-line options to the executable that it runs (nk2edit_32_bit.exe or nk2edit_64_bit.exe)


Import NK2 addresses from a simple comma-delimited (csv) text file

NK2Edit allows you to easily import names and email addresses into your NK2 file from a simple comma-delimited (csv) text file containing the required information. You can generate the csv file by using any text editor, like the Notepad of Windows. NK2Edit can read both ASCII file and Unicode file. However, if you use non-English characters in the 'Display Name' field, it recommended to save the csv file as Unicode, to avoid from any characters conversion problems.
You can also save the csv file with UTF-8 encoding, and NK2Edit will detect it and load it properly, as long as this file has the byte order mark of UTF8 - EFBBBF.

The structure of csv file should look like this one:

SMTP, Nir Sofer, nirsofer@yahoo.com
SMTP, NirSoft Support, support@nirsoft.net
"SMTP", "NirSoft, Sales", "sales@nirsoft.net"
"EX", "NirSoft Admin", "/o=NirSoft/ou=First Administrative Group/cn=Recipients/cn=Admin"
"EX", "Admins Admin", "/o=NirSoft/ou=First Administrative Group/cn=Recipients/cn=Admins",1

The first field of every line should be SMTP for SMTP email addresses or EX for MS-Exchange addresses. The second field is the display name and the third field is the email address for SMTP records or MS-Exchange string for EX records. The fourth field is optional, and it should only be used on special records. 1 for Distribution List, 5 for Private Distribution List, and 6 for Remote User.

The quotes around every field are optional. However, if there is a comma character in the display name field (like in the third line of the example above), you must enclose the field with quotes.

For NK2Edit with commercial license, you can also use /import_csv_file command-line parameter for making the import process automatically from command-line, without displaying any user interface. For more information: NK2Edit Command-Line Options

You can also use the /ssimplecsv command-line option to export the email addresses stored inside the NK2 file into a csv file in the same format that can be used with this import feature.