• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8883
  • Last Modified:

How to send key storke in batch file

Hi Gurus

cd\
cd WINNT\Microsoft.NET\Framework\v1.1.4322\
caspol -ag 1. -Zone Intranet FullTrust

i m having this script in batch file. when i run it do some process and ask me to input y/n

any way to send y "yes" automaically so it wont stop the batch files

Thanks
Dosth
0
dosth
Asked:
dosth
  • 3
  • 2
  • 2
  • +1
2 Solutions
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Couple of methods you can try:

echo y|{command that prompts for input}

or

create a text file, for example, called y.txt, then put a "y" on one line, press enter, save and exit.  

{command that prompts for input}<x:\path\to\file\y.txt

The above option is redirecting input so that instead of taking input from the keyboard, it takes input from the file y.txt (note, you will like need an "enter" or "carriage return" in the file or it would be like typing "y" and never pressing enter.
0
 
omniruCommented:
For this to work you need to feed caspol "yes" string on standard input through input/output redirection. Simplest way is to prepend caspol invocation with "echo <string> |" construct like this:

echo yes | caspol -ag 1. -Zone Intranet FullTrust

Cheers!
0
 
dosthAuthor Commented:
i would like to give 10 points to leew also

how can i do that

thanks
dosth
0
Increase Security & Decrease Risk with NSPM Tools

Analyst firm, Enterprise Management Associates (EMA) reveals significant benefits to enterprises when using Network Security Policy Management (NSPM) solutions, while organizations without, experienced issues including non standard security policies and failed cloud migrations

 
omniruCommented:
May be this FAQ entry can be helpful:

http://www.experts-exchange.com/help.jsp#hi69

Although it says it's impossible to assign less than 20 points.
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
You should read the help file.

The first person who provides the answer should be awarded the points.  In cases when you want to split the points, no person can get less than 20 points.  If you wanted to accept both of our answers, you would have had to increase the point value on the question.

If you like I can reopen the question and you can then increase the value and split the points.  Otherwise, I'll let this pass as it was only 20 points, but understand, many people volunteer their time here to help you - your awarding of points is the primary way of thanking them.  People who don't appropriate award points may cause some experts to stop answering your questions because they don't feel you're going to grade properly.

At the very least, you should explain in any question why you selected the answer you did, to be fair to the others who participated.
0
 
dosthAuthor Commented:
hey

i can increase point :)

please open

thanks
dosth
0
 
dosthAuthor Commented:
did mistake

i am new, not sure how i can hive 20 - 20 for both
0
 
JamesApertaCommented:
you can use -q on the caspol command line to go "quiet" without user interaction required.  Don't know if this is a new option or not but it's available with the .NET 2 caspol.

eg
caspol -q .....

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now