Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6875737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:23:29+00:00 2026-05-27T04:23:29+00:00

I am writing a VBScript script to execute an SQL query in the SQLite

  • 0

I am writing a VBScript script to execute an SQL query in the SQLite shell and was wondering if I needed to use .quit or .exit.

When I set up a task in the task scheduler to run this VBScript script, the SQLite shell doesn’t exit/quit properly due to which I get a new instance created every time the task scheduler run and this is causes the SQL query to not be executed. When I double click on the VBScript script it runs fine and SQLite shell exists gracefully.

How can I fix this?

The script:

Dim objShell
Dim main_database_file, main_output_file, main_sqlite_file
Dim TAB, LINE

' Set default values here if necessary
main_database_file = "G:\example\data\reporting\lastmonth"
main_sqlite_file = "G:\example\sqlite-shell.exe"
main_output_file="G:\example\scripts\display-time.csv"

Set objShell = createObject("Wscript.Shell")

sql = "select * from project;"

objShell.Run """"& main_sqlite_file &"""" & """"& main_database_file &""""
WScript.Sleep(500)
objShell.Sendkeys(".separator ,{ENTER}")
objShell.Sendkeys(".headers ON{ENTER}")
objShell.Sendkeys(".output '" & main_output_file &"'{ENTER}")
objShell.Sendkeys(sql & "{ENTER}")
WScript.Sleep(500)
objShell.Sendkeys(".quit{ENTER}")
Set objShell = Nothing
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:23:29+00:00Added an answer on May 27, 2026 at 4:23 am

    I would agree with Jack that the doc states no difference.
    However, why not pipe your commands in to the Command-Line-Processor? You can create a ‘SQL’ file containing each of the steps above and then execute the single run command:

    Something like (not tested!)

    SQL file:

    .separator ,
    .headers on
    etc..
    

    Then run this file as:

    shell.run "sqlite-clp.exe mydb.db < sqlfile.sql"
    

    There isn’t any need for arbitrary timeouts, and you can probably pass in parameters too.

    PS: It’s probably sendkeys running in the context of a scheduled task that is the problem

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wondering if anyone would be able to help with the following VBScript script
I'm writing a VBScript for SyncBack (backup utility) in which I am deleting old
I'm writing powershell script that simulates actions performed by user on the page. I
I'm writing a vbscript to pull some data from a webpage, strip out a
I'm currently writing something which is validating our vbscript files. Right at the start
Writing a dictionary application for android. Want to set translation direction in accord with
Writing an application for a custom gallery, and all the script files are put
I am writing a Qt application that calls QProcess::startDetached(wscript.exe script.vbs) to show the delete
We inherited a bunch of legacy (10+ years old) VBScript files which use to
I'm writing a .bat file to handle some script generation automatically so I don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.