Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Batch File Command (XP)

    Is it possible (within the batch file) to have the response to (Y/N) automatically select "Yes or No"?

    Within a batch file I can run an exe file but there is a prompt for (Y/N) at the end. In some instances I would like Y and others N. I would like to schedule the batch file to run but am hung up on how to get the proper response.

    Thanks,
    John

  2. #2
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,413
    Thanks
    33
    Thanked 195 Times in 175 Posts

    Re: Batch File Command (XP)

    If there is no option to reply yes or no provided by the program itself (such as /Y or /N), it may be possible to do <pre>echo y|theprogram.exe</pre>

    You can also set up files called y.txt or n.txt containing (yes, you've guessed it!) either a y or an n, and do <pre>theprogram.exe < n.txt</pre>

    Beware that sometimes these techniques do not work, particularly if you have a trailing blank after the y or n anywhere, so check thoroughly.
    BATcher

    Time prevents everything happening all at once...

  3. #3
    Star Lounger
    Join Date
    Feb 2009
    Location
    Evanston, Illinois, USA
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch File Command (XP)

    Hello jstevens: The following batch code lines work for me in deleting all virus files with an extersion of "vir"
    -----------------CUT--------------------------------

    Del/s C:*.vir
    echo y | Del/s C:*.vir*.* > nul

    -----------------CUT--------------------------------

    Theodore

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •