[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


How to send key storke in batch file

Posted on 2006-12-01
Medium Priority
Last Modified: 2008-08-15
Hi Gurus

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

Question by:dosth
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
LVL 96

Accepted Solution

Lee W, MVP earned 80 total points
ID: 18059343
Couple of methods you can try:

echo y|{command that prompts for input}


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.

Assisted Solution

omniru earned 80 total points
ID: 18059346
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

LVL 15

Author Comment

ID: 18059357
i would like to give 10 points to leew also

how can i do that

Q2 2017 - Latest Malware & Internet Attacks

WatchGuard’s Threat Lab is a group of dedicated threat researchers committed to helping you stay ahead of the bad guys by providing in-depth analysis of the top security threats to your network.  Check out our latest Quarterly Internet Security Report!


Expert Comment

ID: 18059369
May be this FAQ entry can be helpful:


Although it says it's impossible to assign less than 20 points.
LVL 96

Expert Comment

by:Lee W, MVP
ID: 18059377
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.
LVL 15

Author Comment

ID: 18059379

i can increase point :)

please open

LVL 15

Author Comment

ID: 18059395
did mistake

i am new, not sure how i can hive 20 - 20 for both

Expert Comment

ID: 21096050
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.

caspol -q .....


Featured Post

Automating Your MSP Business

The road to profitability.
Delivering superior services is key to ensuring customer satisfaction and the consequent long-term relationships that enable MSPs to lock in predictable, recurring revenue. What's the best way to deliver superior service? One word: automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The well known Cerber ransomware continues to spread this summer through spear phishing email campaigns targeting enterprises. Learn how it easily bypasses traditional defenses - and what you can do to protect your data.
In this article, WatchGuard's Director of Security Strategy and Research Teri Radichel, takes a look at insider threats, the risk they can pose to your organization, and the best ways to defend against them.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question