windows批处理sqlite备份firefox历史记录

发布于 2024-12-26 03:49:01 字数 1144 浏览 0 评论 0原文

不熟悉 Windows 的东西..,我正在尝试编写一些 MS Windows 批处理以备份 Firefox 历史记录,但我没有得到预期的结果,例如将 Firefox 历史记录转储到文件中(此处未实现),并且无法弄清楚为什么以及如何解决。相反,我在新窗口中获得数据库转储。这是我到目前为止所做的:

cmd windows 终端

start "TEST" sqlite.cmd

sqlite.cmd

REM backup firefox history
setlocal
set DB_src=places.sqlite
set DB_dest=places1.sqlite
set FF_profile=C:\Documents and Settings\User_A\Application Data\Mozilla\Firefox\Profiles\1e6xxxxx.default
set SQLITE_EXE=C:\Documents and Settings\Admin_User\SoftWare\sqlite3.exe
set SQLITE_SQL=C:\Documents and Settings\Admin_User\Bureau\sqlite.sql
copy "%FF_profile%\%DB_src%" "%FF_profile%\%DB_dest%"
@echo off
start "%SQLITE_EXE%" "%FF_profile%\%DB_dest%" < "%SQLITE_SQL%"
endlocal

sqlite.sql

.dump html
.output moz_places.html
SELECT moz_places.visit_count, moz_places.url FROM moz_places ORDER by visit_count DESC LIMIT 20;

[编辑]:
解决过:
- 使用正确的 sqlite 查询(在下面的 sqlite.sql 中更新),如这些示例
- 使用 sql html 输出“moz_places.html”,因为我无法进行重定向工作。
linux的东西对我来说更容易......

Not familiar with windows stuffs.. , I'm trying to write a little MS Windows batch in order to backup firefox history but I'm not getting the expected result, eg the firefox history dump into a file (not implemented here), and can't figure out why and how to solve. Instead I get a dump of the database in a new window. Here is what I've done till now :

cmd windows terminal

start "TEST" sqlite.cmd

sqlite.cmd

REM backup firefox history
setlocal
set DB_src=places.sqlite
set DB_dest=places1.sqlite
set FF_profile=C:\Documents and Settings\User_A\Application Data\Mozilla\Firefox\Profiles\1e6xxxxx.default
set SQLITE_EXE=C:\Documents and Settings\Admin_User\SoftWare\sqlite3.exe
set SQLITE_SQL=C:\Documents and Settings\Admin_User\Bureau\sqlite.sql
copy "%FF_profile%\%DB_src%" "%FF_profile%\%DB_dest%"
@echo off
start "%SQLITE_EXE%" "%FF_profile%\%DB_dest%" < "%SQLITE_SQL%"
endlocal

sqlite.sql

.dump html
.output moz_places.html
SELECT moz_places.visit_count, moz_places.url FROM moz_places ORDER by visit_count DESC LIMIT 20;

[EDIT]:
Worked around :
- using the right sqlite query (updated in sqlite.sql below)as for these examples.
- using the sql html output "moz_places.html" as I could not get the redirection work.
linux stuffs are easier for me...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

锦欢 2025-01-02 03:49:01

这个问题很蹩脚,因为它涉及三个完全不相关的领域:firefox、sqlite 和批处理文件。您应该通过确定这是 Firefox 问题、sqlite 问题还是批处理文件问题来隔离问题,然后您应该提出有关问题所在域的问题,绝对不提及其他域。

关于批处理文件,我将尽我所能给您一个答案:

首先,您需要停止不必要地使用 start 命令并直接调用事物。因此,

start "%SQLITE_EXE%" "%FF_profile%\%DB_dest%" < "%SQLITE_SQL%"

您需要这样:

"%SQLITE_EXE%" "%FF_profile%\%DB_dest%" < "%SQLITE_SQL%"

然后,您需要将上述命令的输出重定向到您选择的文件中。为此,您需要使用“>”操作员。所以:

"%SQLITE_EXE%" "%FF_profile%\%DB_dest%" < "%SQLITE_SQL%" > myfile.txt

就批处理文件而言,应该可以了。如果没有,那么就是 Firefox 或 sqlite 的问题。

This question is lame, because it involves three completely unrelated domains: firefox, sqlite, and batch files. You should have isolated the problem by determining whether this is a firefox issue or an sqlite issue or a batch file issue and then you should have come up with a question regarding the domain in which the issue lies, with absolutely no mention to the other domains.

I am going to give you an answer as best as I can regarding batch files:

First of all, you need to stop needlessly using the start command and just invoke things directly. So, instead of:

start "%SQLITE_EXE%" "%FF_profile%\%DB_dest%" < "%SQLITE_SQL%"

You need this:

"%SQLITE_EXE%" "%FF_profile%\%DB_dest%" < "%SQLITE_SQL%"

Then, you need to redirect the output of the above command into a file of your choice. For this, you need to make use of the '>' operator. So:

"%SQLITE_EXE%" "%FF_profile%\%DB_dest%" < "%SQLITE_SQL%" > myfile.txt

That should do it, as far as batch files are concerned. If it does not do it, then it is a firefox or sqlite issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文