|
HUNRYBECKY
银牌会员
    
积分 1179
发帖 442
注册 2006-9-9
状态 离线
|
『楼 主』:
根据操作系统的语言创建快捷方式
使用 LLM 解释/回答一下
没有发表过文章,也来发表一下。见笑,还望高手指点。
怎样根据操作系统的语言创建桌面,快速启动和程序菜单中的快捷菜单呢?虽然目前有很多软件都支持,但效果不是很理想,要么创建的快捷方式受到限制,要么就创建的不是很顺利。
其实使用批处理就可以简单的实现。。。。。
首先在文件夹的同目录建立程序的快捷方式,并设置好图标和名称;
其次使用“桌面”,或“程序”等关键字判断是什么语言的操作系统,在根据不同的操作系统建立快捷方式。示范代码如下:
@echo off
rem 建立快捷方式前先隐藏去掉快捷方式的隐藏属性,注意我的快捷方式在上层目录中,名称为“Microsoft Office Access2K Runtime.lnk”
ATTRIB -H ..\"Microsoft Office Access2K Runtime.lnk"
rem 使用IF EXIST判断系统语言并复制快捷方式
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 完成后隐藏快捷方式。
ATTRIB +H ..\"Microsoft Office Access2K Runtime.lnk"
说明:如何在简体系统上获取繁体字:在WINWORD中输入需要的文字,使用繁简转换获得繁体文字,再在记事本中编辑批处理时替换即可。
由于本人工作在广东这边,所以很多时候都使用繁体系统,简体的批处理在繁体上全是乱码,所以可以使用这种思路编写多语版本的提示文字,如
IF EXIST "%ALLUSERSPROFILE%"\"「START」MENU“\ CALL EN.BAT
IF EXIST "%ALLUSERSPROFILE%"\"「开始」菜单"\ CALL CHS.BAT
IF EXIST "%ALLUSERSPROFILE%"\"「開始」菜單"\ CALL CHT.BAT
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
|
|
2006-12-5 23:52 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
判断操作系统的语言版本,可以用 chcp 命令。
To determine the language version of the operating system, you can use the `chcp` command.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-12-6 00:05 |
|
|
HUNRYBECKY
银牌会员
    
积分 1179
发帖 442
注册 2006-9-9
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
请问namejm斑竹,使用namejm怎么来判断呢?我只知道这个东西如果是使用某些纯DOS后不能识别中文,可以用这个东西来转化。请详细解说下。谢谢。
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.
|
|
2006-12-6 00:26 |
|
|
HUNRYBECKY
银牌会员
    
积分 1179
发帖 442
注册 2006-9-9
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
我的意思是判断系统是简体,还是繁体语言
What I mean is to determine whether the system is in simplified or traditional Chinese language
|
|
2006-12-6 00:27 |
|
|
heicai
中级用户
  
积分 385
发帖 156
注册 2007-1-19
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
932日语
936简体
950繁体
1252英语
不知道对不对。
有这些就可以判断了吧?希望楼主完善代码
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
|
|
2007-1-22 09:22 |
|
|
lovehack2006
初级用户
 
积分 135
发帖 64
注册 2006-12-20
状态 离线
|
|
2007-2-16 03:10 |
|
|
33223169
新手上路

积分 7
发帖 4
注册 2007-12-5
状态 离线
|
|
2007-12-5 13:18 |
|
|
Eadmin
新手上路

积分 4
发帖 2
注册 2007-12-17
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
@echo off
cls
for /f "tokens=1,2,3,4" %%h in ('chcp') do (set lang=%%k)
::code page 判斷繁,簡, 其他語言時使用英文
if /i %lang% EQU 950 (goto CHT) else (goto Eng)
if /i %lang% EQU 936 (goto CHS) else (goto Eng)
:CHT
echo 繁體版本
goto EX
:CHS
echo 簡體版本
goto EX
:ENG
echo 英文版本
:EX
::echo 退出
exit
@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
|
|
2008-1-25 00:41 |
|