1.

Solve : Responding to prompts in bat file with a twist?

Answer»

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, vaYou 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...








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,
elaineHave you tried it with a different switch, such as:

net stop MSMQ /y
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



Discussion

No Comment Found