Pipe "y" into net stop on windows

25,607

There is a undocumented parameter that works with net commands, /y or /yes which bypasses the prompt. So in your case it would be:

net stop WAS /y
Share:
25,607

Related videos on Youtube

Tomáš Zato - Reinstate Monica
Author by

Tomáš Zato - Reinstate Monica

It might be easier to hire new management than to get a new community of volunteers. - James jenkins If you play League of Legends, check my repository: http://darker.github.io/auto-client/ I no longer play and I am actively looking for someone to maintain the project. It helped thousands of people, literally.

Updated on September 18, 2022

Comments

  • Tomáš Zato - Reinstate Monica
    Tomáš Zato - Reinstate Monica over 1 year

    I want to stop a service without being prompted. This is what I tried:

    C:\>echo y|net stop WAS
    The following services are dependent on the Windows Process Activation Service service.
    Stopping the Windows Process Activation Service service will also stop these services.
    
       World Wide Web Publishing Service
    
    Do you want to continue this operation? (Y/N) [N]:
    No valid response was provided.
    

    I want to do this within batch job.

    • DukeSilversJazz
      DukeSilversJazz over 6 years
      What about trying: net stop WAS /y
  • imtheman
    imtheman over 6 years
    Ah thanks! I didn't see that. I updated my answer.
  • Tomáš Zato - Reinstate Monica
    Tomáš Zato - Reinstate Monica over 6 years
    Thanks. But do you have any idea why pipe did not work?