中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-07 10:16
48,040 topics / 350,125 posts / today 0 new / 48,252 members
DOS批处理 & 脚本技术(批处理室) » Create shortcuts based on the operating system's language
Printable Version  1,913 / 7
Floor1 HUNRYBECKY Posted 2006-12-05 23:52
银牌会员 Posts 442 Credits 1,179
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
Floor2 namejm Posted 2006-12-06 00:05
荣誉版主 Posts 1,737 Credits 5,226 From 成都
To determine the language version of the operating system, you can use the `chcp` command.
Floor3 HUNRYBECKY Posted 2006-12-06 00:26
银牌会员 Posts 442 Credits 1,179
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.
Floor4 HUNRYBECKY Posted 2006-12-06 00:27
银牌会员 Posts 442 Credits 1,179
What I mean is to determine whether the system is in simplified or traditional Chinese language
Floor5 heicai Posted 2007-01-22 09:22
中级用户 Posts 156 Credits 385
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
Floor6 lovehack2006 Posted 2007-02-16 03:10
初级用户 Posts 64 Credits 135
Good post.. Save it first
Floor7 33223169 Posted 2007-12-05 13:18
新手上路 Posts 4 Credits 7
Floor8 Eadmin Posted 2008-01-25 00:41
新手上路 Posts 2 Credits 4
@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
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023