header1   header
header
header : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
IMPORTANT: PowerShellCommunity.org is moving! - Wednesday, August 15, 2012

PowerShellCommunity.org is moving!  This community software, and the hardware that it sits on, are no longer serving the purposes of this community.  As a result, we have decided to move this community to a new home at PowerShell.org.  PowerShell.org is already up and running with the new community software and in its new location, so please post any new questions that you have on the forums over there instead of posting them on this site.  We've already started getting some great questions from members of the community over there so please, come on over and join us!

While we are going through this transition, this site will remain up for the short term.  New posts may no longer be created on these forums, however replies to existing posts are allowed so that users who posted questions don't have to re-post the same question on the new site.

[UPDATE 28/02/2013] New user registration has been disabled and forums have now been switched to read-only, including for existing posts since all threads that were started should now be completed. If you have a question about content on this site or about PowerShell in general, head over to PowerShell.org and ask it there where there are people actively using the site and answering questions.

If you have any questions, please let us know on the PowerShell.org site.

Thank you,

Kirk "Poshoholic" Munro

 
SQLite commands
Last Post 26 Oct 2010 05:45 AM by viper6277. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
viper6277User is Offline
New Member
New Member
Posts:2
Avatar

--
25 Oct 2010 12:28 PM
    Has anyone had success at running a SQLite command from powershell ?

    at the command prompt, I can execute .... "sqlite test.db3 < script.txt" and it will run sqlite open my test database, and execute my scpript file.

    I have tried this in PowerShell using:

    $command = "./sqlite3 ./test.db3 \< ./script.txt"
    invoke-expression $command

    this is the script.txt file.... ( very simple query)

    .mode list
    .header off
    .output eid.dat
    SELECT employee_id FROM tbl_employees WHERE password ='test';

    and I get an error from SQLite saying to many options...

    I tried using invoke-item ....or using the -command function...to no avail.

    I have found a way around this problem, but it's silly...

    I create a batch script with the command in the batch, ...call the batch from powershell and then delete the batch file... but there has to be an easier way.
    viper6277User is Offline
    New Member
    New Member
    Posts:2
    Avatar

    --
    26 Oct 2010 05:45 AM
    This is the alternative method I came up with to solve my problem


    $st = 'sqlite3 database.db3 < script.txt'


    $echof = '@echo off'


    $echof | Out-File "C:\Users\eddie\Desktop\PowerShell\b1.bat" -encoding ascii


    $st | Out-File "C:\Users\eddie\Desktop\PowerShell\b1.bat" -encoding ascii -append


    invoke-item ./b1.bat




    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Many thanks to our original sponsors: Quest Software • SAPIEN Technologies • Compellent • Microsoft footer
    footer   footer