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-27 00:38
中国DOS联盟论坛 » 其它操作系统综合讨论区 » How to perform case conversion? View 1,610 Replies 9
Original Poster Posted 2006-04-13 13:09 ·  中国 重庆 沙坪坝区 联通
初级用户
Credits 102
Posts 35
Joined 2006-03-16 11:56
20-year member
UID 52168
Status Offline
For example, if you get a variable using set /p, how to unconditionally convert the value of the variable to uppercase?
Floor 2 Posted 2006-04-13 17:38 ·  美国
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
Using 26 commands:
set var=%var:a=A%
set var=%var:b=B%
...
set var=%var:z=Z%

Can achieve the function of the original poster. I only have this clumsy way.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 3 Posted 2006-04-13 23:17 ·  中国 重庆 沙坪坝区 联通
初级用户
Credits 102
Posts 35
Joined 2006-03-16 11:56
20-year member
UID 52168
Status Offline
Floor 4 Posted 2006-04-14 17:19 ·  中国 福建 三明 电信
中级用户
★★
Credits 316
Posts 83
Joined 2005-03-01 00:00
21-year member
UID 36626
Gender Male
Status Offline
I don't know if there are any small software that can realize the conversion of the case of the entire document
Floor 5 Posted 2006-04-14 17:40 ·  中国 上海 黄浦区 电信
金牌会员
★★★★
Credits 4,639
Posts 2,239
Joined 2005-01-30 00:00
21-year member
UID 35785
Gender Male
Status Offline
Floor 6 Posted 2006-04-14 20:07 ·  中国 辽宁 锦州 中移铁通
荣誉版主
★★★
Credits 1,338
Posts 356
Joined 2005-07-15 12:09
21-year member
UID 40733
Gender Male
Status Offline
TO smileseeker

GNU sed can conveniently convert the case of files.

Lowercase: sed "s/\(.*\)/\L\1/" file.txt

Uppercase: sed "s/\(.*\)/\U\1/" file.txt

sed download address: http://www.student.northpark.edu/pemente/sed/gsed407x.zip
  ☆开始\运行 (WIN+R)☆
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul

Floor 7 Posted 2006-04-15 08:20 ·  中国 福建 三明 电信
中级用户
★★
Credits 316
Posts 83
Joined 2005-03-01 00:00
21-year member
UID 36626
Gender Male
Status Offline
Thanks a lot.

The younger brother will first try it out.
Floor 8 Posted 2007-01-25 06:01 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Recently, I found that the DOS version of WINRAR, RAR, has this function. The parameters are rar -cl to convert to uppercase and rar -cu to convert to lowercase.
Floor 9 Posted 2007-01-25 11:14 ·  中国 浙江 宁波 北仑区 电信
新手上路
Credits 1
Posts 2
Joined 2006-12-31 06:23
19-year member
UID 75076
Gender Male
Status Offline
Thanks for the share from the person above!
Floor 10 Posted 2007-01-25 12:12 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
Originally posted by HUNRYBECKY at 2007-1-24 17:01:
Recently, I found that the DOS version of WINRAR, RAR, has this function. The parameters are rar -cl to convert to uppercase and rar -cu to convert to lowercase.


  This can only convert the case of file names, and cannot batch convert the content of files to uppercase or lowercase, right?
Forum Jump: