Smarter Skype Backups

The Problem:

  • Skype History is stored in several .dbb files located in %appdata%/Skype/username/
  • The NirSoft application mentioned below is capable of reading the format used in those files and extracting them to CSV/HTML etc.
  • Unfortunately, Skype actually locks the chat files while its running, so you can’t create these extracts while Skype is open.
  • Obviously, if Skype is always running (my case), it brings problems. It would’ve taken three lines to automatically kill skype, run backups and restart skype, but what happens if I was in an active call?
  • The solution below should help allow you to handle cases where:
    • Skype is not running – The script will run backups.
    • Skype is running with no active calls – The script will shutdown Skype, run backups, restart Skype
    • Skype is running with active call(s) – The script will not do anything.


You will need:

I won’t talk about setting up the pre-requisites too much, but essentially:

  • Grep For Windows:
    1. Download the Grep binary package, and all it’s prerequisities (at the bottom of the page)
    2. Extract them all into one folder.
    3. Add this folder to your %PATH% system environmental variable.
    4. If this has been set up correctly, you will be able to run “grep” from a command prompt anywhere on your system.
  • NirSoft SkypeLogView:
    1. Download and install the program.
    2. You can use the /scomma /backup.csv /sort 2 switch to automate backing up Skype logs.
  • Skype4COM:
    1. Download and extract Skype4COM.dll from the file offered on the Skype Public API website.
    2. Copy this file into your %System32% directory.
    3. Register the DLL using regsvr32 C:\Windows\System32\Skype4COM.dll (Or your equivalent path. – This will probably need to be in SysWOW64 for x64 windows)


I’m not going to do too much explanation on my backup scripts, but they consist of two files which you need to create in the same directory (skype.bat and skype.vbs). Some important notes to consider:

  • The BAT file should be named Skype.bat.
  • If you wish to start this BAT file from another batch process (or similar), it is probably a good idea to call it using “cmd /c skype.bat
  • The VBS file should be named Skype.vbs and be located in the same folder as the BAT file.
  • This script uses hard coded paths, as this was designed to be machine-specific. You will need to adjust these for your own system.
  • The first time you run this script, you will need to tell Skype to allow access to wscript.exe. This script will not work/hang otherwise.

VBS File – Skype.vbs:

'Create a Skype object:
Set oSkype = WScript.CreateObject("Skype4COM.Skype", "Skype_")

'Place a call using this Skype object: (TESTING ONLY)
'Set oCall = oSkype.PlaceCall("echo123")
'Wscript.echo oSkype.ActiveCalls.count

'Return the number of active calls.
Wscript.quit oSkype.ActiveCalls.count

BAT File – Skype.bat:

@echo off

tasklist /FI "IMAGENAME eq Skype.exe" | grep Skype.exe >nul
echo Check 1: Skype running.
goto :incall
) ELSE (
echo Check 1: Skype not running.
goto :backup
exit /b

wscript.exe skype.vbs >nul
IF NOT ERRORLEVEL 1 (goto :kill)
echo Check 2: Skype has active call(s).
echo Action: No action performed.
exit /b

echo Action: Running log backup.
cd \
cd "Program Files\skypelogview"
SkypeLogView.exe /scomma "C:\Logs\Skype\log.csv" /sort 2
if %killed%==true (
echo Action: Restarting Skype.
cd \
cd "Program Files\Skype\Phone"
start skype.exe
exit /b

echo Check 2: Skype has no active call(s).
echo Action: Terminating Skype process.
set killed=true
rem taskkill /f /im Skype.exe
cd \
cd "Program Files\Skype\Phone"
start skype.exe /shutdown
ping -n 10
goto :backup
exit /b

References: [1], [2], [3], [4], [5], [6], [7]

One thought on “Smarter Skype Backups”

Leave a Reply

Your email address will not be published. Required fields are marked *