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-07 09:25
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Create shortcuts based on the operating system's language View 1,911 Replies 7
Original Poster Posted 2006-12-05 23:52 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
I haven't published an article before, so I'm also publishing one. Please excuse me, and I hope experts can give guidance.
How to create the desktop, the quick launch, and the shortcut menus in the program menu according to the language of the operating system? Although there are many software that support it currently, the effect is not ideal. Either the created shortcuts are restricted, or the creation is not very smooth.
In fact, it can be simply realized using batch processing...
First, create a shortcut of the program in the same directory of the folder, and set the icon and name;
Second, use keywords such as "Desktop" or "Program" to judge what language the operating system is, and then create shortcuts according to different operating systems. The sample code is as follows:
@echo off
rem Before creating the shortcut, first hide and remove the hidden attribute of the shortcut. Note that my shortcut is in the upper directory, and the name is "Microsoft Office Access2K Runtime.lnk"
ATTRIB -H ..\"Microsoft Office Access2K Runtime.lnk"
rem Use IF EXIST to judge the system language and copy the shortcut
IF EXIST "%ALLUSERSPROFILE%"\DESKTOP\ copy ..\"Microsoft Office Access2K Runtime.lnk" "%ALLUSERSPROFILE%"\DESKTOP\ /Y
IF EXIST "%ALLUSERSPROFILE%"\桌面\ copy ..\"Microsoft Office Access2K Runtime.lnk" "%ALLUSERSPROFILE%"\桌面\ /Y
IF EXIST "%ALLUSERSPROFILE%"\"「START」MENU"\PROGRAM\ copy ..\"Microsoft Office Access2K Runtime.lnk" "%ALLUSERSPROFILE%"\"「START」MENU"\PROGRAM\ /Y
IF EXIST "%ALLUSERSPROFILE%"\"「开始」菜单"\程序\ copy ..\"Microsoft Office Access2K Runtime.lnk" "%ALLUSERSPROFILE%"\"「开始」菜单"\程序\ /Y
IF EXIST "%ALLUSERSPROFILE%"\"「開始」菜單"\程序\ copy ..\"Microsoft Office Access2K Runtime.lnk" "%ALLUSERSPROFILE%"\"「開始」菜單"\程序\ /Y
copy ..\"Microsoft Office Access2K Runtime.lnk" "%USERPROFILE%"\"Application Data"\"Microsoft"\"Internet Explorer"\"Quick Launch"\ /Y
REM After completion, hide the shortcut.
ATTRIB +H ..\"Microsoft Office Access2K Runtime.lnk"

Explanation: How to obtain traditional Chinese characters on the simplified Chinese system: Enter the required text in WINWORD, use the simplified-traditional conversion to obtain traditional Chinese characters, and then replace them when editing the batch processing in Notepad.
Since I work in Guangdong here, I often use the traditional Chinese system. The simplified Chinese batch processing is all garbled on the traditional Chinese system, so this idea can be used to write multi-language version prompt texts, such as
IF EXIST "%ALLUSERSPROFILE%"\"「START」MENU“\ CALL EN.BAT
IF EXIST "%ALLUSERSPROFILE%"\"「开始」菜单"\ CALL CHS.BAT
IF EXIST "%ALLUSERSPROFILE%"\"「開始」菜單"\ CALL CHT.BAT
Floor 2 Posted 2006-12-06 00:05 ·  中国 广东 电信
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
To determine the language version of the operating system, you can use the `chcp` command.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 3 Posted 2006-12-06 00:26 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Hello, Moderator namejm, how to judge using namejm? I only know that if some pure DOS cannot recognize Chinese, this thing can be used to convert. Please explain in detail. Thanks.
Floor 4 Posted 2006-12-06 00:27 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
What I mean is to determine whether the system is in simplified or traditional Chinese language
Floor 5 Posted 2007-01-22 09:22 ·  中国 浙江 电信
中级用户
★★
Credits 385
Posts 156
Joined 2007-01-19 02:32
19-year member
UID 76955
Gender Male
Status Offline
932 Japanese
936 Simplified Chinese
950 Traditional Chinese
1252 English

I don't know if it's correct.
With these, you can judge, right? Hope the owner improves the code
Floor 6 Posted 2007-02-16 03:10 ·  中国 广东 深圳 电信
初级用户
★★
Credits 135
Posts 64
Joined 2006-12-20 04:35
19-year member
UID 74003
Gender Male
Status Offline
Good post.. Save it first
Floor 7 Posted 2007-12-05 13:18 ·  中国 湖北 荆门 移动
新手上路
Credits 7
Posts 4
Joined 2007-12-05 12:57
18-year member
UID 104732
Gender Male
Status Offline
Floor 8 Posted 2008-01-25 00:41 ·  美国 Verizon
新手上路
Credits 4
Posts 2
Joined 2007-12-17 23:27
18-year member
UID 105985
Gender Male
Status Offline
@echo off
cls

for /f "tokens=1,2,3,4" %%h in ('chcp') do (set lang=%%k)

::Code page judgment for traditional, simplified, and other languages using English
if /i %lang% EQU 950 (goto CHT) else (goto Eng)
if /i %lang% EQU 936 (goto CHS) else (goto Eng)

:CHT
echo Traditional Chinese version
goto EX

:CHS
echo Simplified Chinese version

goto EX

:ENG
echo English version



:EX
::echo Exit

exit
Forum Jump: