-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvoke-ExportEdgeKeywords.ps1
More file actions
44 lines (34 loc) · 1.21 KB
/
Invoke-ExportEdgeKeywords.ps1
File metadata and controls
44 lines (34 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Install / Ensure have sqlite3 executable
If (!(Get-Command sqlite3)) {
scoop install sqlite
}
# Create sql_script.sql
If (!(Test-Path "$PWD\bin\sql_export_script.sql")) {
$SqlScriptPath = "$PWD\bin\sql_export_script.sql"
New-Item -ItemType File -Path $SqlScriptPath
$SqlScriptPath = Convert-Path $SqlScriptPath
echo '.output EdgeKeywords.sql' > $SqlScriptPath
echo '.dump keywords' >> $SqlScriptPath
}
$SqlScriptPath = (Convert-Path $PWD\bin\sql_export_script.sql)
# Copy Web Data
If (Test-Path "$PWD\temp\Web Data") {
Remove-Item -Path "$PWD\temp\Web Data" -Force
}
$EdgeWebDataFilePath = (Convert-Path "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Default\Web Data")
$Destination = "$PWD\temp\Web Data"
Copy-Item $EdgeWebDataFilePath $Destination
# Set Database
$Database = $Destination
# Export keywords from database to sql file
If (Test-Path "$PWD\output\EdgeKeywords.sql") {
Move-Item "$PWD\output\EdgeKeywords.sql" "$PWD\output\EdgeKeywords.sql.bak" -Force
}
$OutputFile = "$PWD\output\EdgeKeywords.sql"
sqlite3.exe -init $SqlScriptPath $Database .exit
# Move output
Move-Item "$PWD\EdgeKeywords.sql" "$PWD\output\EdgeKeywords.sql" -Force
# Cleanup
Remove-Item "$PWD\temp\Web Data"
# View
bat output\EdgeKeywords.sql