另:
) 为什么特殊字符不能处理?
是因为当试图以 set /p=!line:~%%i,1!<nul 指令显示含有特殊符号(例如=等号)内容时系统会认为错误。
为什么系统会认为错误?我们可以分解操作来看到错误的原因:
现在假设 !line:~%%i,1! 取到的一个字符正好是“=”等号,那么就相当于你执行了:
set /p==<nul
这时候系统会提示:
C:\TEMP>set /p==
命令语法不正确。
上面就是运行结果。
但如果要显示一个“=”等号以及特殊符号呢?
C:\TEMP>set /p= =<nul
=
C:\TEMP>
看上面就可以显示“=”等号了,因为在要显示的“=”等号前面加了个空格的原因~:)
…………略过n个分析过程…………
此时候就想一下,如果我前面预先加一个空格,那么再显示文字的时候会怎么样?
(这个实验请亲自做一下~:)
…………略过n个分析过程…………
(实际发现,原来这样达不到要显示的效果,太浪费长度了,哈哈……)
(怎么办?)
(再想……)
(这个时候,会想到,那么怎么才能消掉我多加上的那个空格呢?)
(这时候就有可能会想起ASCII码特殊控制字符--如何想起来?平时多用,多看这些内容,没看过绝对想不起来)
(哪些特殊控制字符可以用呢?--如何知道的?全都试过一遍(因为感兴趣就会全试一遍的:)
(在编程课上或是学C语言的时候也讲过: \n \t 等特殊控制字符……)
(回想……)
(很可能在不断的实验中,突然想起了那个传说中的“退格“字符,那它的ASCII码是多少呢?)
(在ASCII码表上有)
(n过过程历过了以后…………会想到,那这个字符“退格”我如何输入它呢?)
(办法多了,用Debug,用vbs,用edit内的Ctrl+P--等等,这个Ctrl+p如何知道的?)
(多则n天少则几分钟,试呗,有帮助,或偶然间看到的某个资料上写着这样可以,全是经验总结的过程)
(然后,下一步怎么办?)
(退格符可以输入了,可以使用了,如何应用呢?)
(……经过n步的实验会发现怎么字符全没显示出来,全缩转到一起了?)
(原来退格又删掉了刚显示的内容……等等……再想……这不就是传说中的动画呢?)
(经过这些步骤的亲自--一定要亲自全玩过一遍,学会了:
ASCII码
特殊控制字符
显示特殊控制字符
如何延时
什么是延时变量
for的技巧操作
变量的赋值与如何“分割”与“提取”变量的部分内容
如何计数
如何输入特殊控制字符,很有可能连debug的输入特殊字符和简单操作也学会了
如何读文件…………
太多了,但这一切光看好看还不行,那只是表面上懂了(这个懂很可以是记忆力在帮你死记住它,而不是透彻)
yuanzijia08兄自己一个一个试吧,这就是学习和自我了悟的过程~:)
虽然用五笔字型打字和说话的速度一样,字打多了也累~:D
Also:
) Why can't special characters be processed?
It is because when trying to use the instruction set /p=!line:~%%i,1!<nul to display content containing special symbols (such as the equal sign =), the system will consider it an error.
Why does the system consider it an error? We can break down the operation to see the cause of the error:
Now suppose that!line:~%%i,1! takes a character that happens to be "=", then it is equivalent to you executing:
set /p==<nul
At this time, the system will prompt:
C:\TEMP>set /p==
The syntax of the command is incorrect.
The above is the running result.
But if you want to display an equal sign "=" and special symbols?
C:\TEMP>set /p= =<nul
=
C:\TEMP>
As you can see above, the equal sign "=" can be displayed because a space is added in front of the equal sign "=" to be displayed ~:)
…………Skip n analysis processes…………
At this time, think about what will happen if I add a space in front in advance and then display the text?
(Please do this experiment by yourself ~:)
…………Skip n analysis processes…………
(Actually, it is found that this does not achieve the desired display effect, which is too wasteful of length, haha...)
(What to do?)
(Think again...)
(At this time, you will think, then how can I eliminate that extra space I added?)
(At this time, you may remember the ASCII code special control characters - how to remember it? You use it more often, look at these contents more, and you absolutely can't remember it if you haven't read it)
(Which special control characters can be used? - How do you know? Try them all once (because if you are interested, you will try them all once :))
(It was also mentioned in programming classes or when learning C language: special control characters such as \n \t...)
(Recall...)
(Very likely, in continuous experiments, I suddenly remembered that legendary "backspace" character, what is its ASCII code?)
(It is in the ASCII code table)
(After going through n processes... will think, how do I input this character "backspace"?)
(There are many ways, use Debug, use vbs, use Ctrl+P in edit - wait, how do you know this Ctrl+p? )
(Many days or a few minutes, just try it, it is helpful, or seen in some information by chance, all are processes of experience summary)
(Then, what to do next?)
(The backspace character can be input and used, how to apply it?)
(......After n steps of experiments, it will be found that why are all the characters not displayed and all shrunk together? )
(It turns out that backspace has deleted the just displayed content... Wait... Think again... Isn't this the legendary animation?)
(After going through these steps personally - must play through all of them personally, learned:
ASCII code
special control characters
display special control characters
how to delay
what is a delay variable
skillful operations of for
assignment of variables and how to "split" and "extract" parts of variables
how to count
how to input special control characters, very likely even learned the input of special characters and simple operations in Debug
how to read files…………
Too much, but all of this is not enough just to look good, that may only be superficially understood (this understanding can very well be memory helping you to memorize it dead, not thoroughly)
Brother yuanzijia08, try it one by one yourself, this is the process of learning and self-enlightenment ~:)
Although typing with Wubi input method is as fast as speaking, it is tiring after typing too many words ~: D