我也用的 WINXP SP3 CHS, 改了下代码, 显示字符串改了英文, 用了 chcp 437, 结果如愿了- cd \ & @echo on & chcp 437 & ver
- if "〇"=="" (echo 〇 is empty) else echo 〇 is not empty
- if "12〇34"=="1234" (echo SAME) else echo NOT same
- if 12〇34==1234 (echo SAME) else echo NOT same
- if "12〇34" equ "1234" (echo SAME) else echo NOT same
- pause
复制代码 结果如下:Active code page: 437
Microsoft Windows XP [?? 5.1.2600]
D:\>if "⌐û" == "" (echo ⌐û is empty ) else echo ⌐û is not empty
⌐û is not empty
D:\>if "12⌐û34" == "1234" (echo SAME ) else echo NOT same
NOT same
D:\>if 12⌐û34 == 1234 (echo SAME ) else echo NOT same
NOT same
D:\>if "12⌐û34" EQU "1234" (echo SAME ) else echo NOT same
NOT same
曾经也有一个 if 字符串比较的问题(关于短横线,单引号), 网上搜索未果, 到 MS 官网提问, 也没得到答案.
MS 不开源, 好多问题问 MS 也难得解答, 要弄清这类问题有时恐需用到 反编译, DEBUG 之类的手段对 CMD 来一个深度解剖, 我能力不及, 望有乐意用能力者试一下.
[ 本帖最后由 neorobin 于 2010-4-6 21:37 编辑 ] |