×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

standard input of batch file

standard input of batch file

standard input of batch file

(OP)
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.

RE: standard input of batch file

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.

RE: standard input of batch file

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

RE: standard input of batch file

(OP)
thanks for the post, sounds like it might do the trick. i will try it today and tell you the results.
cheers,
richard

RE: standard input of batch file

Did it "do the trick?"

RE: standard input of batch file

(OP)
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

RE: standard input of batch file

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 "good practice" 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 "if" and "where" 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 "CmdLine" to say:
     isql.exe -Usa -P < pass.txt
This way you only need to point & click. I believe it should work.


Anyways, happy hunting.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close