3 Replies - 11835 Views - Last Post: 28 September 2010 - 09:56 PM Rate Topic: -----

#1 knockkneed81  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 52
  • Joined: 05-November 08

Auto answer batch file prompt

Posted 17 November 2008 - 11:22 AM

Batch file is asking if the file that I am copying is a F=file or D=directory I want to automatically answer "F" for file.
Is This A Good Question/Topic? 0
  • +

Replies To: Auto answer batch file prompt

#2 muballitmitte  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 174
  • View blog
  • Posts: 470
  • Joined: 05-November 08

Re: Auto answer batch file prompt

Posted 19 November 2008 - 12:02 AM

please post some code so i`ll know what you mean!!!!!

~~~~~

normally...
if a command asks for a confirmation or smth you could use the pipe operator like this:
 echo y | del <directoryName>


Was This Post Helpful? 0
  • +
  • -

#3 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5355
  • View blog
  • Posts: 27,314
  • Joined: 10-May 07

Re: Auto answer batch file prompt

Posted 19 November 2008 - 12:45 AM

It's probably overkill for what you are trying to accomplish, but there is a program called expect that allows you to setup events at the command prompt such as you are describing. Take a look & see if it'll work for you.
Was This Post Helpful? 0
  • +
  • -

#4 Guest_Just some guest*


Reputation:

Re: Auto answer batch file prompt

Posted 28 September 2010 - 09:56 PM

I think he means something along the lines of
Batch File:
@echo off
set /P q1=Do you want to copy a file or directory?
IF /I %q1%==F (do something here)
IF /I %q1%==D (do something here) 


The batch file asks him if he wants F (a file) or D (a directory) to copy, and he wants to automatically answer F EG:

@echo off
::set /P q1=Do you want to copy a file or directory? (DELETE THIS LINE)
set q1=F
IF /I %q1%==F (do something here)
IF /I %q1%==D (do something here) 



So what you need to do (poster) is search for the text string it asks you.

EG: If it says

Do you want to copy a file or directory?


Search for: Do you want to copy a file or directory?

Then it will say something in the batch file like:

set /P variable=Do you want to copy a file or directory?

Replace that with

set variable=F
Was This Post Helpful? 0

Page 1 of 1