这是什么在Windows批处理文件中? [英] What is this in a windows batch file?
本文介绍了这是什么在Windows批处理文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用谷歌搜索了,我读过,我空白了。我正在编辑批处理文件以进行批量SVN转储和加载。正如所有优秀的开发人员所做的那样,我有一个我获得的脚本,但我想了解所有这些。基本上,脚本遍历存储库列表:
I've googled, I've read, I'm coming up blank. I'm editing a batch file to do a mass SVN dump and load. As all good developers do, I have a script that I acquired, but I'd like to understand all of it. Basically, the script iterates through the list of repositories:
FOR /F %%G IN ('dir /b /ad %repodir%') DO ^
SET dumpfile=%%G.dump
ECHO Starting SVN dump for %%G... >> %repolog% & ^
svnadmin dump %repodir%%%G > %repotdirdump%%%G & ^
问题 - 请参阅插入符号和& ^?这些怎么办?这是for循环的定义方式吗?
谢谢
The question - See the caret and the "& ^"? What do these do? Is this how the for loop is defined?
thanks
推荐答案
奇怪 - '&'是通常用作
statement1&statement2
意味着statement2将在statement1之后运行
那么你可以有
statement1 && statement2
(注意double &&) - 哪个iirc意味着statement2只有在statement1成功时才会运行
到目前为止很好..插入符号'^'通常'逃脱'字符跟随它,也就是说,停止由shell解释的角色,但从某种意义上说,你发现我很难理解
你可以课程使用
... DO(
声明1
..
声明
)
但这可能会改变意图的含义 - 对不起,我无法帮助更多查理,这已经很久很久了(一个d即使在我们的时间,我们也有相当复杂的批处理脚本)
its odd - '&' is usually used as
statement1 & statement2
meaning statement2 will run after statement1
then you can have
statement1 && statement2
(note double &&) - which iirc means statement2 will run only if statement1 is successful
so far so good.. the caret aka '^' usually 'escapes' the character following it, that is, stops the character being interpreted by the shell, but in the sense you've shown I find it hard to make sense of
you can of course use
...DO (
statement1
..
statementn
)
but that might change the meaning of what's intended - sorry I cant help more Charlie, its been a long, long time (and we had quite sophisticated batch scripts even for our time)
你知道,我认为你正在做些什么。我认为这有点像延续。 ^是转义字符,它允许忽略新行 - 我认为。
You know, I think you're on to something. I think it's sort of like a continuation. The "^" is the escape character, and it's there to allow ignoring the new line- I think.
这篇关于这是什么在Windows批处理文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文