在windows平台上,我有以下内容:
schema.sql (包含sql脚本) sqlite3.exe (从sqlite.org下载的sqlite ->命令外壳) build.bat:一行为sqlite3.exe -init schema.sql default.db3的批处理文件
当我运行build.bat时,数据库将按预期的方式创建,但是sqlite不会自动终止。那么,如何使批处理文件自动运行并终止sqlite命令shell?
例如产出:
C:\Work\X\Database>sqlite3.exe -init schema.sql default.db3
-- Loading resources from schema.sql
SQLite version 3.7.4
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> 发布于 2011-04-22 15:25:49
试着这样称呼它:
echo .quit | sqlite3.exe 或者将.quit放在文件的末尾。
发布于 2016-01-14 17:08:09
bat文件似乎缺少exit语句(因为您还没有显示其内容)。你可以自己加上:
sqlite3.exe -init schema.sql default.db3 .exit发布于 2016-10-06 08:11:09
对于sqlite3 3.11 (但不是3.8),我也遇到了同样的问题,对我有用的解决方案是:
sqlite3.exe default.db3 < schema.sql雷吉斯的回答也很好。
https://stackoverflow.com/questions/5756845
复制相似问题