微软 Copilot 怎么也写不出 这个 关机 的 cmd 代码

b
baidukaohe333
楼主 (北美华人网)
You want: - ✅ A visible Yes/No message box. - ✅ A system shutdown if nothing is clicked within 60 seconds. - ✅ Cancellation only if the user explicitly clicks “No”. Clicking "Yes" shuts down righ away.  这个是 它给的 最接近的代码, “是” 和 “否” 按键都有效,但 60 秒后 不会自动关机。
powershell -NoProfile -WindowStyle Hidden -Command ^ Add-Type -AssemblyName PresentationFramework; ^ $timer = [System.Threading.Timer]::new({ shutdown /s /t 0 }, $null, 60000, [System.Threading.Timeout]::Infinite); ^ $result = [System.Windows.MessageBox]::Show( ^ ''''The system will shut down in 60 seconds. Click YES to shut down now, or NO to cancel.'''', ^ ''''Confirm Shutdown'''', ''''YesNo'''', ''''Warning''''); ^ $timer.Dispose(); ^ if ($result -eq ''''Yes'''') { shutdown /s /t 0 } elseif ($result -eq ''''No'''') { shutdown /a }
哪位能帮忙问问 chatgpt?

b
baidukaohe333
改变了问问题的方法,先问简单的,再加功能,貌似做出来了。