我需要檢查 %test% 是否不等于 Y 或 N,我該怎么做?
set /p test=
if /i %test% equ Y goto y
if /i %test% equ N goto n
uj5u.com熱心網友回復:
如果提供的值沒有通過測驗,那么它一定不是-(y,Y,n,N),所以批處理只是繼續下一條指令。不需要特定的測驗。
但是 - 請考慮choice哪個是為此任務設計的。使用 Gerhard 示例的工具或search查看檔案 -從提示中。[batch-file] choicechoice /?
在比較中,用于if "thing1" == "thing2" ...避免thing1/2.
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/485743.html
標籤:批处理文件
