批处理脚本:在 DO 中包含文件句柄 %%i(子函数
我有点卡住了,需要一些建议。
我首先使用 %%i 作为文件变量执行 FOR 循环。
for %%i in ("C:\*.*") do (
call :function1 "%%i"
goto function2
goto :eof
)
问题是文件参数没有提供给函数一。
我已经测试过在函数 1 中放置“echo my echo is %%”,我得到:
my echo is %i
并且 exacltle 与在 function2 中使用 %%i
有人给我建议吗?如何获取要以 DO 形式运行的文件句柄?顺便说一句,这是 Windows 批处理。
I'm a bit stuck and need some advice.
I start by doing a FOR loop with %%i as the file variable.
for %%i in ("C:\*.*") do (
call :function1 "%%i"
goto function2
goto :eof
)
the problem is that the file-parameter isn't given to function one..
I have tested with putting an 'echo my echo is %%' in function1 and i get:
my echo is %i
And exacltle the same for the use of %%i in function2
Does anyone has advice for me? How do i get the file handle to be taken to function in the DO form? By the way, this is windows batch.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我实际上找到了噩梦的根源,而且非常简单。贝利撒留提到的解决方案很好,但它确实使我的其余代码无法使用。
所以关于解决方案:
没错!该死的括号!!但这是一个新的教训;)
感谢您抽出时间贝利撒留
I actually found the source of my nightmares and it was pretty simple. The solution mentioned by belisarius was good but it did made the rest of my code unusable.
So on the the solution:
That's right! Damn brackets!! But that's a new lesson learnd ;)
Thanx for your time Belisarius