Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: prompt in bat  (Read 4739 times)

0 Members and 1 Guest are viewing this topic.

joesruk

    Topic Starter


    Greenhorn

    prompt in bat
    « on: February 25, 2010, 08:27:44 AM »
    hi there,

    this is what I'm trying to make into a bat, it's to run a txt file against an sql database, the problem is, it gets as far as the third line, then brings up a prompt >  where the line .read UpdateBS.sql is the next step .  How do I get this to work please?


    cd\
    cd "C:\Program Files\K\BS"
    SQLIte3 BS.sqb
    .read UpdateBS.sql
    .quit
    pause


    mtia
    Mark

    gpl



      Apprentice
    • Thanked: 27
      Re: prompt in bat
      « Reply #1 on: February 26, 2010, 12:53:05 AM »
      I have had a VERY quick look at the documentation - I think you might get somewhere with this:

      create a text file containing your interactive commands:

      .read UpdateBS.sql
      .quit

      Call it sqlcmds.txt

      now on the commandline, run this
      Code: [Select]
      SQLIte3 BS.sqb < sqlcmds.txt
      What this does is tell SQLIte3 to run with the command line param that you had (BS.sqb) - but when it prompts for interaction, ignore the keyboard and take the input from the sqlcmds.txt file, line by line as if they had been typed in.

      Check out 'redirection of input' here on this site and others to understand

      Good luck
      Graham

      joesruk

        Topic Starter


        Greenhorn

        Re: prompt in bat
        « Reply #2 on: February 26, 2010, 03:38:47 AM »
        thanks very much Graham, that's done it

        Mark

        joesruk

          Topic Starter


          Greenhorn

          Re: prompt in bat
          « Reply #3 on: January 28, 2011, 08:30:42 AM »
          H,

          one more question please,  this was what I've been using:

          cd\
          cd "C:\Program Files\KA\BS"
          SQLite3 BS.sqb <Readcmd.txt

          but some users of my programme have their installation on other drives, not the same drive as their DOS cmd default and have been having trouble.   It has been suggested to me that the first line should in fact be that drive for example if it was on the E:drive

          E:
          cd\
          cd "E:\Program Files\KA\BS"
          SQLite3 BS.sqb <Readcmd.txt

          is this correct, will it make a difference?

          mtia
          Joe

          joesruk

            Topic Starter


            Greenhorn

            Re: prompt in bat
            « Reply #4 on: February 07, 2011, 04:24:02 AM »
            can someone give me an answer to this please?

            mtia
            Joe

            maymon123



              Rookie

              • Experience: Familiar
              • OS: Windows XP
              Re: prompt in bat
              « Reply #5 on: February 09, 2011, 10:26:04 AM »
              I would say yes to your question, joesruk.

              Salmon Trout

              • Guest
              Re: prompt in bat
              « Reply #6 on: February 09, 2011, 10:30:54 AM »
              You can specify a drive and folder this way

              E:
              cd\
              cd "Program Files\KA\BS"

              or this way using cd with the /d switch

              cd /d "E:\Program Files\KA\BS"


              joesruk

                Topic Starter


                Greenhorn

                Re: prompt in bat
                « Reply #7 on: February 09, 2011, 11:14:38 AM »
                thanks guys