Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Responding to prompts in bat file with a twist  (Read 5067 times)

0 Members and 1 Guest are viewing this topic.

eppack

    Topic Starter


    Starter

    • Experience: Expert
    • OS: Windows XP
    Responding to prompts in bat file with a twist
    « on: October 30, 2012, 01:27:55 PM »
    I have a bat file to stop/start my message queuing. Since the MSMQ triggers are dependent on queuing being there, it will ask me if I really want to do this, and waits for a "Y". Not sure of the syntax to suppress or auto answer this prompt. Tried /Q and an echo pipe but neither worked. Here's the bat file (and the message is at the first command:

    net stop MSMQ
    timeout 3
    net start MSMQ
    timeout 3
    net start "Message Queuing Triggers"

    TIA!

    elaine
    ivy, va

    Salmon Trout

    • Guest
    Re: Responding to prompts in bat file with a twist
    « Reply #1 on: October 30, 2012, 03:34:33 PM »
    You tried this? (pipe?)

    1. echo a y character through a pipe

    echo y | net stop whatever
    echo y | net start whatever


    if so, try this, redirecting a file to console input

    echo y > yes.txt
    net stop whatever < yes.txt
    net start whatever < yes.txt


    You will appreciate that you really only need to make yes.txt once, and I leave you to guess what might be in no.txt...









    eppack

      Topic Starter


      Starter

      • Experience: Expert
      • OS: Windows XP
      Re: Responding to prompts in bat file with a twist
      « Reply #2 on: November 05, 2012, 06:01:04 AM »
      I tried both methods, Salmon Trout, but in both cases (and just on the remote chance they are case sensitive, tried that too)  they throw:

      Do you want to continue this operation? (Y/N) [N]:
      No valid response was provided.

      Thanks,
      elaine

      oldun

      • Guest
      Re: Responding to prompts in bat file with a twist
      « Reply #3 on: November 05, 2012, 04:06:53 PM »
      Have you tried it with a different switch, such as:

      net stop MSMQ /y

      eppack

        Topic Starter


        Starter

        • Experience: Expert
        • OS: Windows XP
        Re: Responding to prompts in bat file with a twist
        « Reply #4 on: November 06, 2012, 05:40:23 AM »
        We have a winner, Oldun!! That works great! Thank you!

        I didn't see that as a switch on the net command--is that undocumented?

        Cheers!

        elaine
        ivy, va