关于windows批处理脚本可靠性的问题
我有一个很长的 Windows 批处理脚本。中间有一个部分使用 appcmd 来检测 IIS 中站点的根路径。该部分在独立执行时运行良好。但是,当我执行整个批次时,此部分可能偶尔无法检测到站点路径。我对这个不可靠的问题感到完全困惑。以前有人遇到过这个吗?
谢谢
解决方案
变量声明和生效之间似乎存在一些延迟。我更改了批处理文件某些部分的顺序,到目前为止它运行良好。我必须说,这仍然很奇怪。
I got a quite long windows batch script. In the middle of it there's a section using appcmd to detect the root path of a site in my IIS. That section runs fine when executed standalone. But when I execute the whole batch, this section could fail to detect the site path once in a while. I am totally confused by this unreliability issue. Have anyone met this before?
Thanks
Solution
It seems that there's some delay between a variable declaration and its coming into effect. I changed the order of some part of the batch file and it runs fine so far. I must say, it's still weird.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于我不知道您的未知代码中存在什么类型的问题,因此我只能在批处理文件中显示已知的不可预测或随机行为。
1- 行尾的多任务回显
有时但并非总是如此,换行符和回车符会打印为 ASCII 字符 10/13(一个圆圈和一个注释),而不是开始新行。
2- 有时但并非总是 %~^LF 的扩展崩溃,然后命令窗口立即关闭。
As I don't know what type of problem you have in your unknown code, I can only show the known unpredicable or random behaviour in batch-files.
1- multiple tasks echo of line ends
Sometimes but not always the linefeeds and carriage returns are print as the ASCII-Chars 10/13 (a circle and a note) instead of begin a new line.
2- Sometimes but not always an expansion of %~^LF crashes, then the command window closes immediatly.