1.

Solve : prompt in bat?

Answer»

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
MarkI 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
Grahamthanks very much Graham, that's DONE it

MarkH,

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

cd\
cd "C:\Program Files\KA\BS"
SQLite3 BS.sqb
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
is this correct, will it make a difference?

mtia
Joecan someone give me an answer to this please?

mtia
JoeI would say yes to your question, joesruk. 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"

thanks guys



Discussion

No Comment Found