Re quan_zhou:
其实我的英文也可以说是很差,很多东西都是硬着头皮看下来的。LMOD的主要作用将源文本根据指定的要求过滤、转换为目标文本,你能生成另一文件,其实就已经离将其保存到环境变量的要求很近了,你只需要在其前面加上一句set 1=并且将它生成到批处理中调用就可以实现了。
题外话:感觉在 autoexec.bat 中使用 file a 1 s.txt 这些没有含义或含义过泛的变量或文件名字,有些过于随意了。请不要见怪 <img src="images/smilies/face-laugh.png" align="absmiddle" border="0">
关于问题1的LMOD方案:
lmod set 1= < s.txt > _setvar.bat
if exist _setvar.bat for %%c in (call del) do %%c _setvar.bat
关于问题2的LMOD方案(因为不知道是否可以控制行号的输出位数,所以采用了二次过滤的方法,也许 Climbing 兄或其他熟悉 LMOD 的朋友有更好的办法):
lmod /l* : < 3.txt | lmod /l* > 4.txt
或者这样(它们是等效的,前者更符合书写习惯,后者较贴近阅读习惯):
< 3.txt lmod /l* : | lmod /l* > 4.txt
Last edited by willsort on 2005-9-24 at 12:48 ]
Re: Quanzhou:
Actually, my English can also be said to be very poor. I read a lot of things reluctantly. The main function of LMOD is to filter and convert the source text into the target text according to the specified requirements. If you can generate another file, you are already very close to the requirement of saving it to an environment variable. You only need to add a line "set 1=" in front of it and generate it to be called in a batch file to achieve it.
Off-topic: I feel that using variables or file names without meaning or too general, such as "file a 1 s.txt" in autoexec.bat, is too casual. Please don't take offense :).
Regarding the LMOD solution for question 1:
lmod set 1= < s.txt > _setvar.bat
if exist _setvar.bat for %%c in (call del) do %%c _setvar.bat
Regarding the LMOD solution for question 2 (since I don't know if the output digit of the line number can be controlled, so a two-time filtering method is adopted. Maybe Brother Climbing or other friends familiar with LMOD have better methods):
lmod /l* : < 3.txt | lmod /l* > 4.txt
Or like this (they are equivalent. The former is more in line with the writing habit, and the latter is closer to the reading habit):
< 3.txt lmod /l* : | lmod /l* > 4.txt
Last edited by willsort on 2005-9-24 at 12:48 ]