@echo off                                                                                                                                                                             
  set DB=%1
  if "%DB%"=="" (                                                                                                                                                                       
      echo Usage: %0 ^<path-to-ecs.sqlite^>
      exit /b 1                                                                                                                                                                         
  )
  sqlite3 "%DB%" ^                                                                                                                                                                      
      "BEGIN; CREATE TEMP TABLE _s AS SELECT vr.id rid, vr.guid rg FROM vms_resource vr JOIN vms_storage vs ON vs.resource_ptr_id=vr.id; DELETE FROM vms_kvpair WHERE resource_guid IN
  (SELECT rg FROM _s); DELETE FROM vms_resource_status WHERE guid IN (SELECT rg FROM _s); DELETE FROM vms_storage WHERE resource_ptr_id IN (SELECT rid FROM _s); DELETE FROM            
  vms_resource WHERE id IN (SELECT rid FROM _s); COMMIT;"