Originally posted by zhxy9804 at 2008-11-11 13:47:
能给解释七楼代码的意思吗,看不懂啊,谢谢了!:(
七楼写的代码
for /f "tokens=1,3,4" %+ in ("hello world batch fans") do @echo %+/%,/%-
读取“hello world batch fans” 按照空格(默认)分隔符进行拆分成一个个token,取出1,3,4个token,依次赋值给%+ %, %- (因为根据ASCII码值,43对应+,44对应, 45对应-),所以%+为hello %,为batch %-为fans
最后结果为hello/batch/fans
Originally posted by zhxy9804 at 2008-11-11 13:47:
Can you explain the meaning of the code on the seventh floor? I don't understand it, thank you! :(
Code on the seventh floor
for /f "tokens=1,3,4" %+ in ("hello world batch fans") do @echo %+/%,/%-
Read "hello world batch fans", split into individual tokens according to the space (default) delimiter, take the 1st, 3rd, and 4th tokens, and assign them to %+ %, %- respectively (because according to ASCII code values, 43 corresponds to +, 44 corresponds to ,, 45 corresponds to -). So %+ is hello %, is batch %- is fans
The final result is hello/batch/fans