But then I thought, why not use SQLite3 in a .BAT file, and make it "one-click" ?
The following code is what I have put into a .BAT file - I don't see any errors, and both just create a blank .CSV on my Desktop.1.) Broken out, for examination
2.) Quotes and apostrophes - not sure what's necessary - it seems like quotes are probably necessary, if there's a space in the path
3.) Just has apostrophes - not sure what's necessary
Any idea why this isn't working?
Re: Help . . . I want to Export my Firefox Bookmarks to .CSV in one click, using SQLite3 in a .BAT file
You have to do two things to run SQL statements from a batch file:
1. Use quotes so that all parameters to sqlite3.exe are a single parameter; and
2. Use quotes so that SQL strings are delimited correctly.
> sqlite3.exe -csv "C:\...\places.sqlite" "SELECT ... datetime(...,"unixepoch","localtime") AS Date FROM ..."
Double quotes are interpreted by cmd.exe to delimit parameters to sqlite3.exe,
so they will not show up in the actual SQL statement as seen by sqlite3.
> sqlite3.exe -csv C:\...\places.sqlite SELECT ... datetime(...,'unixepoch','localtime') AS Date FROM ...
Without quotes, there are too many parameters.
In SQL, strings should use single quotes (double quotes are just for bug
compatibility with MySQL); and cmd.exe expects double quotes for parameters.
So this is easy:
sqlite3.exe -csv "C:\...\places.sqlite" "SELECT ... datetime(...,'unixepoch','localtime') AS Date FROM ..."