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-04 13:13
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Why can " <nul " in "set /p=1< nul" display characters without line breaking? View 2,083 Replies 3
Original Poster Posted 2007-05-02 09:23 ·  中国 安徽 芜湖 电信
高级用户
★★
Credits 537
Posts 219
Joined 2006-10-31 21:08
19-year member
UID 69036
Gender Male
From 芜湖
Status Offline
set /p=1<nul
set /p=2<nul
Why does using "<nul" make it not wrap and display characters?
How to explain it??
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
zwdeee +1 2008-07-29 22:01
江湖远
碧空长
路茫茫

一个人漫无目的的奔跑,风,刺骨的冷....
Floor 2 Posted 2007-05-02 11:02 ·  中国 浙江 杭州 电信
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
Usage of set /p:
set /p variable=prompt string:
Output the prompt string in the console; assign the user's input (ended by pressing Enter) to the variable; note that the user's input is on the same line;
Its own characteristics determine that it can not wrap lines;
<nul assigns an empty string to the variable to shield the user's input, so it seems that it just displays the prompt string on the console without requiring the user to input; at the same time, note that there is no carriage return passed, so there will be no line break;
In this case, the variable can be omitted..
Abbreviated as set /p=prompt string<nul
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
huzixuan +2 2007-05-02 13:53
zwdeee +1 2008-07-29 22:02
Floor 3 Posted 2007-05-02 11:03 ·  中国 浙江 杭州 电信
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
ps: This kind of problem has been said a lot...
Please search first
Floor 4 Posted 2007-05-02 13:53 ·  中国 安徽 芜湖 电信
高级用户
★★
Credits 537
Posts 219
Joined 2006-10-31 21:08
19-year member
UID 69036
Gender Male
From 芜湖
Status Offline
Thanks, next time I'll be careful.
江湖远
碧空长
路茫茫

一个人漫无目的的奔跑,风,刺骨的冷....
Forum Jump: