自动从批处理文件创建SQLite数据库

Emi*_*nem 5 sqlite shell build batch-file

在Windows平台上,我有以下内容:

  • schema.sql (包含sql脚本)
  • sqlite3.exe (sqlite的命令shell - >从sqlite.org下载)
  • build.bat :包含以下行的批处理文件: sqlite3.exe -init schema.sql default.db3

当我运行build.bat时,数据库按预期创建,但是,sqlite shell不会自动终止.那么如何让批处理文件自动运行并终止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>  
Run Code Online (Sandbox Code Playgroud)

And*_*rey 4

尝试这样称呼它:

echo .quit | sqlite3.exe 
Run Code Online (Sandbox Code Playgroud)

或者放在.quit文件的末尾。