标题: [文本处理] 批处理消失的磁盘 [打印本页]
作者: Topgunguy 时间: 2012-8-7 23:05 标题: 批处理消失的磁盘
各位版友大家好,我想请教一个有关参数变数的问题。
用以下程式执行 C:\a.txt 时- @echo off
- echo]%1
- (for %%f in (%*) do (
- call echo]%%%%f
- ))
- pause
复制代码
结果会是
C:\a.txt
\a.txt
请问为什麽for出来的 「C:」这两个字元会消失呢?
感谢~
作者: powerbat 时间: 2012-8-7 23:43
记得有个帖子说过(好像是batcher转载的),%与:结合时会引起变量扩展行为。
作者: Demon 时间: 2012-8-8 09:26
变量拓展搞的鬼,与for无关。- @echo off
- echo %C:\a.txt
- setlocal disableextensions
- echo %C:\a.txt
- pause
复制代码
作者: Topgunguy 时间: 2012-8-8 23:14
第一次看到要关掉的,学习了
感谢D大
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |