Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

standard input of batch file 1

Status
Not open for further replies.

mrmovie

Technical User
Oct 2, 2002
3,094
GB
hello all,
I have a batch file which runs on a w2k server.
i want to automate a backup of a qip dns service
i have a set of commands which need to be typed.
i start off with
isql -Usa -P
then i have to hit the return key
the command prompt window displays a 1>
then i have to type
load -b no_log
then i have to hit the return key
the command prompt window then displays a 2>
then i have to type
go
then i have to hit the return key.

would anyone be able to tell me how to do this in a batch file please?
i have tried "echo" but this doesnt seem to do anything.
 
If I understand, you need to send keystrokes to STDIN. There is no way that I am aware of to do this through a batch.
 
Based on what you've said, it may be possible. IF 'isql' is a true DOS program. I've used this for older DOS programs in the past, but don't know if w2k will allow this.

Try this test:

In a text file (I'll call it PassThru.txt) type in exactly what you want it to do.

Example follows:
{PassThru.txt contents}

-Usa -P{press return key here}
load -b no_log{press return key}
go{press return key}
{then save this text file in an available path}



Then in your batch file, you'll have to redirect the input to the DOS program.

Example Follows:
{Batch file contents}
isql < PassThru.txt


It'll be interesting to find out if this works or not. So, try this out and let us know the results.

--MiggyD
 
thanks for the post, sounds like it might do the trick. i will try it today and tell you the results.
cheers,
richard
 
hmm i think it has
i had to issue the following command though

isql.exe -Usa -P < pass.txt

with pass.txt containing

dump log no_etc
go

trouble is i dont know what the command should do, ie how to check that it did dump the log ect ect, but what the heck i learnt something and i dont get horrible errors etc.
thanks for you input and patience.
regards
richard
 
Glad you got it to work. I didn't really need a star, but thanks anyways.

I was more interested to see if redirecting would work, if the program is a DOS compiled program, on a w2k sys.

Since it was &quot;good practice&quot; way in the past, you might be able to get some help (in lieu of missing manuals) by typing isql.exe /? or isql.exe /help (maybe even use a hyphen instead of a slash?)

Hopefully, the coder did include a tiny help. If so, you may be able to determin &quot;if&quot; and &quot;where&quot; a log file can be found...then run a test to verify it is deleted after your batch file runs.


Suggestion:
You may be able to create a shortcut and edit its properties. In particular the &quot;CmdLine&quot; to say:
isql.exe -Usa -P < pass.txt
This way you only need to point & click. I believe it should work.


Anyways, happy hunting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top