|
dikex
高级用户
    潜水修练批处理
积分 788
发帖 366
注册 2006-12-31
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
这个可否??紧限于输出
type test.txt>output.txt
Is this okay?? Limited to output
type test.txt>output.txt
|

正在潜水修练的批处理小白 |
|
2007-5-18 14:13 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
?
namejm上面的帖子针对的是哪个帖子说的?
我觉得当引号个数为奇数是就会把 echo后所有的东西全部输出;
因此无法重定向;
我认为解决方法为给每个引号加转义;
对于偶数;觉得不会出错
?
Which post is the post above targeting?
I think when the number of quotation marks is odd, all the content after echo will be output;
Therefore, redirection is not possible;
I think the solution is to escape each quotation mark;
For even numbers, I think there will be no mistakes
|
|
2007-5-18 14:18 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
呵呵,我使用的代码不是你的版本,说法出错了,我收回这个说法。
Hehe, the code I'm using is not your version, the statement is wrong, I take back this statement.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2007-5-18 14:23 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
不知不觉中,bjsh已经把所有的特殊字符的输出问题都解决完了,剩下的事情就是效率的提升和代码的精简/规范问题了。
Unknowingly, bjsh has solved all the output problems of special characters, and the remaining tasks are efficiency improvement and code simplification/standardization.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2007-5-18 14:27 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
Originally posted by dikex at 2007-5-18 14:13:
这个可否??紧限于输出
type test.txt>output.txt
type方案仅限于整个文本的输出,而我想讨论的是对指定行内容里的所有特殊字符的原样输出,我的标题有点误导人了,这就改改。
Originally posted by dikex at 2007-5-18 14:13:
Is this okay?? Only for output
type test.txt>output.txt
The type method is only limited to the output of the entire text, but what I want to discuss is the original output of all special characters in the content of the specified line. My title is a bit misleading, so I'll change it.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2007-5-18 14:29 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
重定向到文本中的代码
@echo off
if exist tmp.txt del tmp.txt
set var=
for /f "delims=" %%a in ('findstr /n .* test.txt') do (
set "var=%%a"
call set "var=%%var:"=%%"
call :change
)
goto :eof
:change
set "var=%var:^=^^%"
set "var=%var:>=^>%"
set "var=%var:<=^<%"
set "var=%var:&=^&%"
set "var=%var:|=^|%"
set "var=%var:*:=%"
if not defined var echo.>>tmp.txt & goto :eof
call set "var=%%var:="%%"
call echo.%%var%%>>tmp.txt
注释:
call set "var=%%var:"=%%"
中的:"=%%"里的"空格"不是空格是ctrl+BackSpace的特殊字符;
Last edited by bjsh on 2007-5-18 at 02:47 PM ]
Redirect to the code in the text
@echo off
if exist tmp.txt del tmp.txt
set var=
for /f "delims=" %%a in ('findstr /n .* test.txt') do (
set "var=%%a"
call set "var=%%var:"=%%"
call :change
)
goto :eof
:change
set "var=%var:^=^^%"
set "var=%var:>=^>%"
set "var=%var:<=^<%"
set "var=%var:&=^&%"
set "var=%var:|=^|%"
set "var=%var:*:=%"
if not defined var echo.>>tmp.txt & goto :eof
call set "var=%%var:="%%"
call echo.%%var%%>>tmp.txt
Notes:
In "call set "var=%%var:"=%%"", the " " in "%%" is not a space but a special character from ctrl+BackSpace;
Last edited by bjsh on 2007-5-18 at 02:47 PM ]
|
|
2007-5-18 14:44 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
我记得关于这个在无奈何签名的那个帖子中已经有一个很好的方案了吧!
I remember there was a very good solution in the post with the signature of Wuna iHe already!
|
|
2007-5-22 21:00 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
 『第 23 楼』:
使用 LLM 解释/回答一下
最新代码:
简练且效率高
@echo off
for /f "delims=" %%a in ('findstr /n .* test.txt') do (
set "var=%%a"
setlocal enabledelayedexpansion
set var=!var:*:=!
echo.!var!
endlocal
)
有兴趣的帮忙测试
Latest code:
Concise and efficient
@echo off
for /f "delims=" %%a in ('findstr /n .* test.txt') do (
set "var=%%a"
setlocal enabledelayedexpansion
set var=!var:*:=!
echo.!var!
endlocal
)
Interested people help test
此帖被 +7 点积分 点击查看详情 评分人:【 vkill 】 | 分数: +6 | 时间:2007-5-24 13:50 | 评分人:【 cutebe 】 | 分数: +1 | 时间:2009-10-17 13:38 |
|
|
|
2007-5-23 15:56 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 24 楼』:
使用 LLM 解释/回答一下
这可能是最简洁高效的代码了,变量延迟大有文章可作啊。
This might be the most concise and efficient code. There's a lot to be done with variable delays.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2007-5-23 22:41 |
|
|
bjsh
银牌会员
    
积分 2000
发帖 621
注册 2007-1-1
状态 离线
|
『第 25 楼』:
使用 LLM 解释/回答一下
简析环境变量和变量延迟特殊字符以及中介法的微妙关系
是写上面代码的后感..
Last edited by bjsh on 2007-11-14 at 12:11 AM ]
A brief analysis of the subtle relationship among environment variables, special characters for variable delay, and the intermediate method
This is the afterthought of writing the above code.
Last edited by bjsh on 2007-11-14 at 12:11 AM ]
|
|
2007-5-23 22:56 |
|
|
zjl5
初级用户
 
积分 82
发帖 15
注册 2007-5-26
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
不知道效果怎么样..
@echo off
for /f "eol= delims=" %%i in (a.txt) do (
set type=%%i
for /l %%j in (0,1,100) do (
setlocal EnableDelayedExpansion
if "!type:~%%j,1!"==" " (set/p= <nul)
if "!type:~%%j,1!"=="=" (set/p= <nul&set/p==<nul) else (
call set/p="%%type:~%%j,1%%"<nul)
endlocal)
echo.
)
pause>nul
I don't know how the effect will be..
@echo off
for /f "eol= delims=" %%i in (a.txt) do (
set type=%%i
for /l %%j in (0,1,100) do (
setlocal EnableDelayedExpansion
if "!type:~%%j,1!"==" " (set/p= <nul)
if "!type:~%%j,1!"=="=" (set/p= <nul&set/p==<nul) else (
call set/p="%%type:~%%j,1%%"<nul)
endlocal)
echo.
)
pause>nul
|
|
2007-10-5 05:00 |
|
|
zzs162
初级用户
 
积分 27
发帖 11
注册 2006-3-16
状态 离线
|
|
2008-4-25 05:23 |
|
|
radem
高级用户
    CMD感染者
积分 691
发帖 383
注册 2008-5-23
状态 离线
|
『第 28 楼』:
使用 LLM 解释/回答一下
受益非浅!
但还有一问题:怎样用P修改含特殊符号的文本,如:
将test.txt
ip 125.219.59.216
sv_contact "568ggstart@163.Com"
// 服务器构建者的联系邮箱
sv_send_resources 1
// 自动向客户端传送地图关联的 *.res文件里包括的资源文件
sv_maxrate 25000
// 服务器最大传输速率 <0-25000>
改为:
ip 59.32.211.105
sv_contact "568ggstart@163.Com"
// 服务器构建者的联系邮箱
sv_send_resources 1
// 自动向客户端传送地图关联的 *.res文件里包括的资源文件
sv_maxrate 25000
// 服务器最大传输速率 <0-25000>
Benefited a lot!
But there is still one problem: How to modify the text containing special symbols with P? For example:
Change test.txt
ip 125.219.59.216
sv_contact "568ggstart@163.Com"
// Contact email of the server builder
sv_send_resources 1
// Automatically send resource files included in the *.res file associated with the map to the client
sv_maxrate 25000
// Server maximum transmission rate <0-25000>
to:
ip 59.32.211.105
sv_contact "568ggstart@163.Com"
// Contact email of the server builder
sv_send_resources 1
// Automatically send resource files included in the *.res file associated with the map to the client
sv_maxrate 25000
// Server maximum transmission rate <0-25000>
|

 |
|
2008-6-22 00:27 |
|
|
silanger
初级用户
 
积分 22
发帖 10
注册 2008-9-15
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
太高深了,光看不顶说不过去,顶一下又恐说我外行凑热闹。还是顶了吧
It's too profound. It's hard to say not to top it after just reading. But I'm afraid that topping it would make me look like an amateur joining in. Still, I'll top it.
|
|
2008-9-16 20:57 |
|
|
laihaibin08
新手上路

积分 13
发帖 15
注册 2008-10-19
状态 离线
|
『第 30 楼』:
使用 LLM 解释/回答一下
我们几位版主真是太有才了
Our several moderators are really very talented
|
|
2008-10-19 17:25 |
|