China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 03:31
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Experts please come in: how do I compare whether two strings are the same? View 851 Replies 3
Original Poster Posted 2009-06-12 22:10 ·  中国 广东 东莞 联通
初级用户
★★
Credits 201
Posts 92
Joined 2005-12-28 17:44
20-year member
UID 48072
Status Offline
With the code below, I found during execution that it can't compare them. How should this be handled?

@echo off
@for /f "tokens=2*" %%i in ('reg query HKLM\SOFTWARE\Clients\Mail /v "" ^| findstr /i /c:"REG_SZ"') do ( set client=%%j)
@msg %username% /time 3 "检测到邮件默认程序:"%client%
@set MO='Microsoft Outlook'
@set HO='Hotmail'
@set WL='Windows Live Mail'
@set WM='Windows Mail'
@set OE='Outlook Express'
:@if '%client%' = %MO% (goto NS)
:@if '%client%' = %HO% (goto NS)
:@if '%client%' = %WL% (goto NS)
:@if '%client%' = %WM% (goto NS)
@if not '%client%' == %OE% (goto NS) else (goto OE)
Floor 2 Posted 2009-06-12 22:15 ·  中国 广东 东莞 联通
初级用户
★★
Credits 201
Posts 92
Joined 2005-12-28 17:44
20-year member
UID 48072
Status Offline
I made a post yesterday, and it actually got deleted.
Floor 3 Posted 2009-06-12 22:44 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Try changing the single quotes to double quotes.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 4 Posted 2009-06-12 23:44 ·  中国 广东 东莞 联通
初级用户
★★
Credits 201
Posts 92
Joined 2005-12-28 17:44
20-year member
UID 48072
Status Offline
After changing them to double quotes, it seems to work.
Forum Jump: