windows - Force batch file to answer yes to prompts -


i've seen question answered here, doesn't seem work specific example. i'm writing brief batch file first time, , command want perform is:

net time \\compname /set 

this prompts yes or no confirmation. wanted avoid batch file , saw people saying can add:

echo y | net time... 

however, when command, can see asks confirmation , following has line saying: "no valid response provided."

does know if there flag unaware of fix or why in case echo y being piped in gives funny response?

the net time command supports (undocumented) parameter "/yes", answer in case quite simple:

net time \\compname /set /yes 

Comments