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-06-25 06:55
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » What is the difference between echo. and echo? View 1,896 Replies 5
Original Poster Posted 2010-12-11 18:31 ·  中国 广东 广州 电信
新手上路
Credits 2
Posts 4
Joined 2010-12-09 02:20
15-year member
UID 178963
Gender Male
Status Offline
Ask everyone

The content in 1.txt is: 123123

The content in 1.bat is:
type 1.txt |find "123123"
echo %ERRORLEVEL%
echo.type 1.txt |find "123123"
echo %ERRORLEVEL%

The result returns 0 and 1, why not 0 and 0??
Floor 2 Posted 2010-12-11 18:52 ·  中国 吉林 延边朝鲜族自治州 延吉市 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
What is the purpose of the building "echo.type 1.txt"?
Floor 3 Posted 2010-12-12 12:18 ·  中国 吉林 长春 电信
初级用户
枫中残雪
Credits 65
Posts 43
Joined 2010-04-29 23:20
16-year member
UID 165810
Gender Male
From 吉林省长春市
Status Offline
I'm not sure what you're up to, but the execution of echo.type 1.txt |find "123123" is wrong, so it returns "1"
type 1.txt |find "123123"
echo %ERRORLEVEL%
echo "type 1.txt |find "123123""
echo %ERRORLEVEL%
pause
Floor 4 Posted 2010-12-13 10:45 ·  中国 广东 广州 电信
新手上路
Credits 2
Posts 4
Joined 2010-12-09 02:20
15-year member
UID 178963
Gender Male
Status Offline
Thanks! Now it's okay.

I want to use HOST to block URLs (block those that pop up a lot of ads when opening a web page)

set list1=.\Website.txt 'Inside are ad URLs
set list2=%windir%\system32\drivers\etc\hosts

for /f "tokens=1,2 delims==" %%i in (%list1%) do (
set Website=%%i
type !list2! |find "!Website!" 1>2>nul
if !ERRORLEVEL! neq 0 (
echo.127.0.0.1 !Website!>>!list2!)
)
Floor 5 Posted 2010-12-13 10:46 ·  中国 广东 广州 电信
新手上路
Credits 2
Posts 4
Joined 2010-12-09 02:20
15-year member
UID 178963
Gender Male
Status Offline
Originally posted by Hanyeguxing at 2010-12-11 18:52:
What is the purpose of the building "echo.type 1.txt"?



Thank you! It's okay now.

I want to use HOST to block URLs (block those annoying ads that pop up as soon as you open a web page)

set list1=.\Website.txt 'Inside are the URLs of ads
set list2=%windir%\system32\drivers\etc\hosts

for /f "tokens=1,2 delims==" %%i in (%list1%) do (
set Website=%%i
type !list2! |find "!Website!" 1>2>nul
if !ERRORLEVEL! neq 0 (
echo.127.0.0.1 !Website!>>!list2!)
)
Floor 6 Posted 2010-12-25 11:52 ·  中国 广东 东莞 中移铁通
初级用户
★★
Credits 115
Posts 92
Joined 2010-12-24 16:57
15-year member
UID 179794
Gender Male
Status Offline
Learning
Forum Jump: