|
HUNRYBECKY
银牌会员
    
积分 1179
发帖 442
注册 2006-9-9
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
Originally posted by HUNRYBECKY at 2007-2-13 04:20:
─────────────────── 版务记录 ────────────────────
执行:namejm
说明:{tid=27658}与本主 ...
谢谢处罚,因为当时比较急,又要放假了,想在放假前做处理,放假后可能很少上网,不是很方便,所以发多个帖子以加快回答的速度.我以后会记住的.
Originally posted by HUNRYBECKY at 2007-2-13 04:20:
─────────────────── Moderation Record ────────────────────
Performed by: namejm
Description: {tid=27658} and the owner ...
Thank you for the punishment. At that time, I was in a hurry and the holiday was coming. I wanted to make the processing before the holiday. I might surf the Internet rarely after the holiday, which was not very convenient. So I posted multiple posts to speed up the response speed. I will remember it in the future.
|
|
2007-2-13 22:35 |
|
|
HUNRYBECKY
银牌会员
    
积分 1179
发帖 442
注册 2006-9-9
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
再问下高手门一个问题:我想在下面的批处理IME.BAT中根据用户的选择IME.SVE来决定删除和备份那些输入法,但是遇到一个问题:
ime\IMJP8_1
system32\imjp81.ime
system32\imjp81k.dll
system32\kbdjpn.dll
system32\msir3jp.dll
system32\msir3jp.lex
ime\IMJP8_1是文件夹,表示日文输入,后面几个是日文输入的几个关联文件,我备份时要同时把该目录和其他几个关联文件一起压缩到一文件夹命名如IMJP8_1中,如何做到?因为这里有三个难点:一是在路径层次不确定的情况下如何以文件夹的最后一个\名称来命名,问题已经由12楼的ZH159兄解决,二是如果区分判断IME.SVE中所列是文件夹还是文件,我使用FINDSTR+扩展名判断,还是有点问题;三是如何根据第二个难点的判断把文件压缩添加到相应的压缩包中?
可能我的描述不是很清楚,表达能力不好,见谅,见下面的代码
批处理IME.BAT的内容
@ECHO OFF
SET PATH=%CD%;%CD%\TOOLS\;%PATH%
IF NOT EXIST BACKUP\IME MD BACKUP\IME
FOR /F "EOL=;DELIMS=" %%I IN ('FINDSTR /I/V ".ime .mb .lex .tbl .hlp .cnt .dll" .\Purge\IME.SVE') DO (
ECHO 正在压缩备份输入法%windir%\%%I\下的文件,请稍等......
PING 127.0.0.1 -n %TIMEOUT% >NUL
RAR.EXE A -ED -EP3 -IDQ ".\BACKUP\IME\%%~nI" "%windir%\%%I"
)
PAUSE
IME.SVE的内容:
;要备份和清理的输入法和键盘布局文件名请放到这里:如是简体系统则默认保留智能ABC;内码输入;全拼输入;繁体则保留(新)注音输入法,另外必须注意有目录的输入法保留时请使用目录,如MS拼音PINTLGNT,否则必须输入带扩展名的具体输入法的所有文件
;简体输入法名称:PINTLGNT:微软拼音3.0;IMSC40W:微软拼音4.0;智能ABC:WINABC;全拼:WINPY;双拼:Winsp;Winzm:郑码;Wingb:内码;Winbx:表形
;繁体输入法名称:新倉頡:CINTLGNT;倉頡:chajei;新注音:TINTLGNT;注音:phon.ime;速成:quick;BIG5码:winime;行列:winar30;:大易:dayi;U码:unicdime;英数:romanime
;其他输入法名称:IMKR6_1韩文输入;IMJP8_1日文输入
;
;
;可备份和清理的输入法,如果想保留则使用;注释掉要清理的项目;也可以添加其他输入法,如%ProgramFiles%\wnwb2005
;简体中文输入法
system32\IME\PINTLGNT
;
;繁体中文输入法
ime\CHTIME
system32\IME\CINTLGNT
system32\IME\TINTLGNT
;
;日文输入法(保留IMJP8_1)
ime\IMJP8_1
system32\imjp81.ime
system32\imjp81k.dll
system32\kbdjpn.dll
system32\msir3jp.dll
system32\msir3jp.lex
ime\imejp98
ime\imejp
;
;韩文输入法
ime\IMKR6_1
system32\imekr61.ime
system32\kbdkor.dll
system32\korwbrkr.dll
system32\korwbrkr.lex
;
;保留的键盘布局如下
;kbdus.dll
Last edited by HUNRYBECKY on 2007-2-13 at 11:03 PM ]
Let me ask the experts another question: I want to decide which input methods to delete and back up according to the user's choice of IME.SVE in the following batch processing IME.BAT, but I encountered a problem:
ime\IMJP8_1
system32\imjp81.ime
system32\imjp81k.dll
system32\kbdjpn.dll
system32\msir3jp.dll
system32\msir3jp.lex
ime\IMJP8_1 is a folder, indicating Japanese input, and the following several are several related files of Japanese input. When I back up, I need to compress this directory and other several related files together into a folder named such as IMJP8_1. How to do it? Because there are three difficulties here: First, how to name by the last \ name of the folder when the path level is uncertain. The problem has been solved by brother ZH159 on the 12th floor. Second, if to distinguish and judge whether what is listed in IME.SVE is a folder or a file. I use FINDSTR + extension judgment, but there are still some problems; Third, how to add files to the corresponding compressed package according to the judgment of the second difficulty?
Maybe my description is not very clear, and my expression ability is not good. Please forgive me. See the following code
The content of batch processing IME.BAT
@ECHO OFF
SET PATH=%CD%;%CD%\TOOLS\;%PATH%
IF NOT EXIST BACKUP\IME MD BACKUP\IME
FOR /F "EOL=;DELIMS=" %%I IN ('FINDSTR /I/V ".ime .mb .lex .tbl .hlp .cnt .dll" .\Purge\IME.SVE') DO (
ECHO 正在压缩备份输入法%windir%\%%I\下的文件,请稍等......
PING 127.0.0.1 -n %TIMEOUT% >NUL
RAR.EXE A -ED -EP3 -IDQ ".\BACKUP\IME\%%~nI" "%windir%\%%I"
)
PAUSE
The content of IME.SVE
; Please put the file names of the input methods and keyboard layouts to be backed up and cleaned here: If it is a simplified Chinese system, it will retain Smart ABC by default; Internal code input; Full Pinyin input; If it is traditional Chinese, it will retain (new) Zhuyin input. In addition, please note that when retaining the input method with a directory, please use the directory, such as MS Pinyin PINTLGNT. Otherwise, you must enter all the files of the specific input method with extension
; Simplified Chinese input method name: PINTLGNT: Microsoft Pinyin 3.0; IMSC40W: Microsoft Pinyin 4.0; Smart ABC: WINABC; Full Pinyin: WINPY; Double Pinyin: Winsp; Winzm: Zhengma; Wingb: Internal code; Winbx: Biaoxing
; Traditional Chinese input method name: New Cangjie: CINTLGNT; Cangjie: chajei; New Zhuyin: TINTLGNT; Zhuyin: phon.ime; Such速成: quick; BIG5 code: winime; Hanglie: winar30; : Dayi: dayi; U code: unicdime; English number: romanime
; Other input method names: IMKR6_1 Korean input; IMJP8_1 Japanese input
;
;
; The input methods that can be backed up and cleaned. If you want to retain, use; comment out the items to be cleaned; you can also add other input methods, such as %ProgramFiles%\wnwb2005
; Simplified Chinese input method
system32\IME\PINTLGNT
;
; Traditional Chinese input method
ime\CHTIME
system32\IME\CINTLGNT
system32\IME\TINTLGNT
;
; Japanese input method (retain IMJP8_1)
ime\IMJP8_1
system32\imjp81.ime
system32\imjp81k.dll
system32\kbdjpn.dll
system32\msir3jp.dll
system32\msir3jp.lex
ime\imejp98
ime\imejp
;
; Korean input method
ime\IMKR6_1
system32\imekr61.ime
system32\kbdkor.dll
system32\korwbrkr.dll
system32\korwbrkr.lex
;
; The retained keyboard layouts are as follows
; kbdus.dll
Last edited by HUNRYBECKY on 2007-2-13 at 11:03 PM ]
|
|
2007-2-13 22:57 |
|
|
HUNRYBECKY
银牌会员
    
积分 1179
发帖 442
注册 2006-9-9
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
另外问个小问题:
一.如何在发帖子时给文本加颜色之类的以便突出显示,我这里怎么没有这些显示?
二.建议斑竹修改帖子的字数限制为100字符,字数太少,难以表达清楚.
Another small question:
1. How to add colors and other things to the text to highlight it when posting a thread? Why don't I have these display options here?
2. It is suggested that the moderator modify the word limit of the post to 100 characters. The word limit is too low, making it difficult to express clearly.
|
|
2007-2-13 23:03 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
  『第 19 楼』:
使用 LLM 解释/回答一下
判断是否文件夹(缺点:不能区分包含“.”名称的文件夹):
@echo off
for /f "delims=" %%i in (list.txt) do if not "%%~xi" == "" echo %%~ni
pause
list.txt
ime\IMJP8_1
system32\imjp81.ime
system32\imjp81k.dll
system32\kbdjpn.dll
system32\msir3jp.dll
system32\msir3jp.lex
Determine whether it is a folder (shortcoming: cannot distinguish folders with names containing "."):
@echo off
for /f "delims=" %%i in (list.txt) do if not "%%~xi" == "" echo %%~ni
pause
list.txt
ime\IMJP8_1
system32\imjp81.ime
system32\imjp81k.dll
system32\kbdjpn.dll
system32\msir3jp.dll
system32\msir3jp.lex
|
|
2007-2-13 23:10 |
|
|
HUNRYBECKY
银牌会员
    
积分 1179
发帖 442
注册 2006-9-9
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
Originally posted by zh159 at 2007-2-13 23:10:
判断是否文件夹(缺点:不能区分包含“.”名称的文件夹):
@echo off
for /f "delims=" %%i in (list.txt) do if not "%%~xi" == "" echo % ...
ZH159兄,这个判断虽然可以判断是否是文件夹,但是一是判断后如果是文件则得不到扩展名,所以备份时无法进行.二是无法根据把文件添加到相应的文件夹中。
@ECHO OFF
SET PATH=%CD%;%CD%\TOOLS\;%PATH%
SET TIMEOUT=1
IF NOT EXIST BACKUP\IME MD BACKUP\IME
FOR /F "EOL=;DELIMS=" %%I IN (.\Purge\IME.SVE) DO (
PING 127.0.0.1 -n %TIMEOUT% >NUL
ECHO 正在压缩备份输入法%windir%\%%I\下的文件,请稍等......
FOR /F "DELIMS=" %%A in ('ECHO %%I^|FINDSTR /I/V ".ime .mb .lex .tbl .hlp .cnt .dll"') DO (
ECHO %%A
)
)
PAUSE
我在代码中再加入FOR +FINDSTR来联合根据获取的变量I来判断,但是遗憾的是ECHO %%I ^|FINDSTR在FOR语句中似乎有问题,根本得理想的结果,即使说获取的结果居然%%A居然和%%I是一样的,等于没有一样,但是我单独测试,也就是不用在FOR语句中则是成功的,真有点不不明白了.
Originally posted by zh159 at 2007-2-13 23:10:
Judge whether it is a folder (disadvantage: cannot distinguish folders with names containing "."):
@echo off
for /f "delims=" %%i in (list.txt) do if not "%%~xi" == "" echo % ...
Brother ZH159, although this judgment can determine whether it is a folder, first, if it is a file after judgment, the extension cannot be obtained, so the backup cannot be carried out. Second, it cannot add files to the corresponding folder.
@ECHO OFF
SET PATH=%CD%;%CD%\TOOLS\;%PATH%
SET TIMEOUT=1
IF NOT EXIST BACKUP\IME MD BACKUP\IME
FOR /F "EOL=;DELIMS=" %%I IN (.\Purge\IME.SVE) DO (
PING 127.0.0.1 -n %TIMEOUT% >NUL
ECHO Compressing and backing up the files under %windir%\%%I for input method, please wait...
FOR /F "DELIMS=" %%A in ('ECHO %%I^|FINDSTR /I/V ".ime .mb .lex .tbl .hlp .cnt .dll"') DO (
ECHO %%A
)
)
PAUSE
I added FOR + FINDSTR in the code to jointly judge according to the obtained variable I, but unfortunately, ECHO %%I ^|FINDSTR seems to have a problem in the FOR statement, and the ideal result is not obtained at all. That is to say, the obtained result is that %%A is actually the same as %%I, which is equivalent to nothing. But when I test it alone, that is, without using it in the FOR statement, it is successful. I really don't understand it.
|
|
2007-2-13 23:32 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
要扩展名简单啊:
@echo off
for /f "delims=" %%i in (list.txt) do if not "%%~xi" == "" echo %%~nxi
pause
It seems this is a batch script content. The translation of the Chinese part "要扩展名简单啊:" is "It's simple to get the file extension:". The whole content after translation is:
It's simple to get the file extension:
@echo off
for /f "delims=" %%i in (list.txt) do if not "%%~xi" == "" echo %%~nxi
pause
|
|
2007-2-13 23:46 |
|
|
HUNRYBECKY
银牌会员
    
积分 1179
发帖 442
注册 2006-9-9
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
Originally posted by zh159 at 2007-2-13 23:46:
要扩展名简单啊:
@echo off
for /f "delims=" %%i in (list.txt) do if not "%%~xi" == "" echo %%~nxi
pause
非常谢谢兄的回答,刚才我一直测试,扩展名的问题已经解决,但是就是我刚才说的第二个问题很难解决,如何保持得到的文件名称以便是文件的时候直接追加到刚才的文件夹中?因为如果不是文件夹的时候变量会覆盖掉原来的变量.
为了便于测试,我上传了整个文件.请运行里面的TEST.BAT测试,谢谢
Last edited by HUNRYBECKY on 2007-2-14 at 12:52 AM ]
Originally posted by zh159 at 2007-2-13 23:46:
The extension should be simple:
@echo off
for /f "delims=" %%i in (list.txt) do if not "%%~xi" == "" echo %%~nxi
pause
Thank you very much for your answer. Just now I have been testing, and the problem of the extension has been solved. But the second problem I just mentioned is very difficult to solve. How to keep the obtained file name so that when appending to the previous folder directly? Because if it is not a folder, the variable will overwrite the original variable.
In order to facilitate testing, I uploaded the entire file. Please run the TEST.BAT inside to test, thank you
Last edited by HUNRYBECKY on 2007-2-14 at 12:52 AM ]
附件
1: test.rar (2007-2-14 00:52, 256.19 KiB, 下载附件所需积分 1 点
,下载次数: 6)
|
|
2007-2-14 00:32 |
|
|
HUNRYBECKY
银牌会员
    
积分 1179
发帖 442
注册 2006-9-9
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
自己顶一下,今天下午开始放假啦,希望放假前有人给我一个思路,谢谢.
祝大家新年快乐,百事可乐.
Bump my own post. I started having a holiday this afternoon. Hope someone can give me an idea before the holiday. Thanks.
Wish everyone a happy new year and all the best.
|
|
2007-2-14 02:10 |
|
|
HUNRYBECKY
银牌会员
    
积分 1179
发帖 442
注册 2006-9-9
状态 离线
|
『第 24 楼』:
使用 LLM 解释/回答一下
经过不断的构思和调试,终于搞定了,其实很简单,因为变量每次要被替换掉,即使使用SET语句也一样,那么能不能像VB ,VBS设置全局变量一样呢,经过测试把变量写入一个文本中,然后再读入就达到了模仿VB,VBS的全局变量的效果,经过测试,下面代码完全达到了我所要的效果,工夫不费有心人,同时还是非常感谢ZH159,VIKILL等我对的问题回答.
测试:请下载22楼代码,并更换TEST.BAT中的内容为以下内容
@ECHO OFF
SET PATH=%CD%;%CD%\TOOLS\;%PATH%
SET TIMEOUT=1
IF NOT EXIST BACKUP\IME MD BACKUP\IME
FOR /F "EOL=;DELIMS=" %%I IN (.\Purge\IME.SVE) DO (
FOR /F "DELIMS=" %%A IN ("%%I") DO (
IF "%%~xA"=="" (
PING 127.0.0.1 -n %TIMEOUT% >NUL
ECHO 正在压缩备份输入法%windir%\%%I\下的文件,请稍等......
RAR.EXE A -ED -EP3 -IDQ ".\BACKUP\IME\%%~nA" "%windir%\%%I"
ECHO %%~nA>"%TEMP%\LIME.TXT"
) ELSE (
FOR /F "DELIMS=" %%J IN (%TEMP%\LIME.TXT) DO (
RAR.EXE A -ED -EP3 -IDQ ".\BACKUP\IME\%%J" "%windir%\%%I"
)
)
)
)
DEL /F/Q/A "%TEMP%\LIME.TXT"
GOTO END
:END
PAUSE
After continuous conception and debugging, it was finally done. Actually, it's very simple because the variable needs to be replaced each time. Even using the SET statement is the same. Then, can it be like setting global variables in VB, VBS? After testing, writing the variable into a text file and then reading it achieves the effect of imitating global variables in VB, VBS. After testing, the following code completely achieves the effect I wanted. No effort is in vain for those who put in the effort. At the same time, I'm very grateful to ZH159, VIKILL and others for answering my questions.
Test: Please download the code on floor 22 and replace the content in TEST.BAT with the following content
@ECHO OFF
SET PATH=%CD%;%CD%\TOOLS\;%PATH%
SET TIMEOUT=1
IF NOT EXIST BACKUP\IME MD BACKUP\IME
FOR /F "EOL=;DELIMS=" %%I IN (.\Purge\IME.SVE) DO (
FOR /F "DELIMS=" %%A IN ("%%I") DO (
IF "%%~xA"=="" (
PING 127.0.0.1 -n %TIMEOUT% >NUL
ECHO Compressing and backing up files under %windir%\%%I\ input method, please wait......
RAR.EXE A -ED -EP3 -IDQ ".\BACKUP\IME\%%~nA" "%windir%\%%I"
ECHO %%~nA>"%TEMP%\LIME.TXT"
) ELSE (
FOR /F "DELIMS=" %%J IN (%TEMP%\LIME.TXT) DO (
RAR.EXE A -ED -EP3 -IDQ ".\BACKUP\IME\%%J" "%windir%\%%I"
)
)
)
)
DEL /F/Q/A "%TEMP%\LIME.TXT"
GOTO END
:END
PAUSE
|
|
2007-2-14 03:08 |
|
|
csx163
初级用户
 
积分 97
发帖 45
注册 2007-1-31
状态 离线
|
『第 25 楼』:
使用 LLM 解释/回答一下
%~nI - 仅将 %I 扩充到一个文件名
%~xI - 仅将 %I 扩充到一个文件扩展名
%~nxI 可以这样用??
%~nI - Expand %I to a file name only
%~xI - Expand %I to a file extension only
Can %~nxI be used like this??
|
|
2007-2-14 05:35 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
for/?
可以组合修饰符来得到多重结果:
%~dpI - 仅将 %I 扩充到一个驱动器号和路径
%~nxI - 仅将 %I 扩充到一个文件名和扩展名
%~fsI - 仅将 %I 扩充到一个带有短名的完整路径名
%~dp$PATH:i - 查找列在路径环境变量的目录,并将 %I 扩充
到找到的第一个驱动器号和路径。
%~ftzaI - 将 %I 扩充到类似输出线路的 DIR
Last edited by zh159 on 2007-2-13 at 05:34 PM ]
for/?
You can combine modifiers to get multiple results:
%~dpI - Expand %I to just a drive letter and path
%~nxI - Expand %I to just a file name and extension
%~fsI - Expand %I to a full path name with a short name
%~dp$PATH:i - Search the directories listed in the PATH environment variable and expand %I to the first found drive letter and path.
%~ftzaI - Expand %I to a DIR-like output line
Last edited by zh159 on 2007-2-13 at 05:34 PM ]
|
|
2007-2-14 06:33 |
|
|