

In this example, the caption is simply Delete Files. If you have to answer Y Enter twice then you could do echo Y > answer.txt echo Y > answer.txt call KB923088.bat < answer.txt To provide a more accurate answer we will probably need more information, like how these Windows updates are called, the code in the batch file, what you have to answer, what OS, etc. Who could forget good old Abort, Retry, and Ignore? There are other values that can give you different message box configurations for example, you could have a message box with buttons labeled Abort, Retry, and Ignore. This is specified by the VBScript constant vbYesNo. In this example, the message is Do you want to delete these files? Msgbox("Do you want to delete these files?", _Īll we’re doing here is creating a message box that features the following: How hard is that? Hey, it’s no harder than these few lines of code: intAnswer = _ There are a couple different ways that you can do this, but because you’re dealing with users the best way is probably to just pop up a message box and let them click Yes or No. How do I ask a user a Yes or No question like this? chmod +x long_script.Hey, Scripting Guy! I have a script which performs some file management tasks, and then should ask the user whether or not they want to delete a set of files. Hot Shot Mark as New Bookmark Subscribe Mute Subscribe to RSS Feed Print Email to a Friend Report Inappropriate Content 07-08-2019 04:52 AM.

To test this, copy the script to a file and save it as long_script.sh. Pipe the echo yn to the commands in Windows PowerShell or CMD that ask Yes/No questions, to answer them automatically. Subscribe to RSS Feed Mark Topic as New Mark Topic as Read Float this Topic for Current User Bookmark Subscribe Mute Printer Friendly Page ganapa2000. bat file, i wrote: net use /delete but CMD wants me to supply a Y or N answer to the question Are you sure What should i add to the batch file in order to auto answer with a Y to that question. Pressing Enter with no input text does nothing. Solved Auto Answer Y to net use /Delete 0 Hi I want to have a batch file that will disconnect all my network shares. 3 Answers Sorted by: 48 From the OPTIONS section of man apt-get -y, -yes, -assume-yes Automatic yes to prompts assume 'yes' as answer to all prompts and run non-interactively.

Any other input is considered a negative response.A “yes” or “y” indicates a positive response.The logic flow within the script is decided upon by the input from the user. This script asks a question and awaits a response. # treat anything else as a negative response (We need to imagine that this is a part of a much larger script that will take a considerable time to run.) #!/bin/bashĮlif ] || ] then BTW, there is no need for ChDir, you can remove that lines. Your long process will then run through to completion unattended with yes providing the answers to any questions the process asks. What code do I need to add to my macro that will automatically answer 'Yes' to the dialog box Add Application.DisplayAlerts False at the top of the macro and Application.DisplayAlerts True at the bottom. S Delete specified files from all subdirectories. P Prompts for confirmation before deleting each file. Rep: Automatically passing an answer to a commands prompt. If a directory is specified, all files within the directory will be deleted. It outputs y s one per line indefinitely so it can be piped to commands that ask yes/no questions.

If you know in advance that all your answers are going to be positive (“yes” or “y”) or negative (“no” or “n”) you can use yes to provide those responses for you. Wildcards may be used to delete multiple files.
