tags:

views:

239

answers:

2

Hi! I need a backup script but the executed program after executing asks Y or N for continuing. How to write a script to automatically insert Y.

for example the program acts like this c:\tool\backup.exe -b Continue Y, N?

now I would need that I create a bat script, but how to insert Y automatically?

A: 

A commandline program usually has a switch for automatically answering the questions with Y (this is usually -Y) but if your program doesn't have a switch like that, I don't think you can easily accomplish what you want to do...

Edit: Johannes is right, his suggestion should be an easy way to accomplish this... why haven't I thought about this ;-)

Anyways, If that doesn't work you can always try to accomplish this externally with something like AutoIt.

fretje
+3  A: 

If the program doesn't have a switch to turn off interactive behavior, you can use

echo Y | someprogram.exe

which will look to someprogram as if the user would have entered Y.

Joey