- 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:
- Download the Grep binary package, and all it’s prerequisities (at the bottom of the page)
- Extract them all into one folder.
- Add this folder to your %PATH% system environmental variable.
- If this has been set up correctly, you will be able to run “grep” from a command prompt anywhere on your system.
- NirSoft SkypeLogView:
- Download and install the program.
- You can use the /scomma
/backup.csv /sort 2switch to automate backing up Skype logs.
- Download and extract Skype4COM.dll from the file offered on the Skype Public API website.
- Copy this file into your %System32% directory.
- 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")
'Return the number of active calls.
BAT File – Skype.bat:
tasklist /FI "IMAGENAME eq Skype.exe" | grep Skype.exe >nul
IF NOT ERRORLEVEL 1 (
echo Check 1: Skype running.
) ELSE (
echo Check 1: Skype not running.
wscript.exe skype.vbs >nul
IF NOT ERRORLEVEL 1 (goto :kill)
echo Check 2: Skype has active call(s).
echo Action: No action performed.
echo Action: Running log backup.
cd "Program Files\skypelogview"
SkypeLogView.exe /scomma "C:\Logs\Skype\log.csv" /sort 2
if %killed%==true (
echo Action: Restarting Skype.
cd "Program Files\Skype\Phone"
echo Check 2: Skype has no active call(s).
echo Action: Terminating Skype process.
rem taskkill /f /im Skype.exe
cd "Program Files\Skype\Phone"
start skype.exe /shutdown
ping 127.0.0.1 -n 10