gpt4 book ai didi

windows - 你如何拥有一个被调用的 bat 文件而不杀死它正在调用的 bat 文件?

转载 作者:可可西里 更新时间:2023-11-01 14:40:29 29 4
gpt4 key购买 nike

我在 Windows 2003 系统上,需要编写脚本来删除和创建 WebSphere Application Server 中的配置文件。这需要我调用 manageprofiles.bat 两次,一次删除现有配置文件,一次创建新配置文件。

在我的批处理文件中,我有以下内容:

cd "C:\Program Files\IBM\WebSphere\AppServer\bin"
manageprofiles.bat -delete -profileName AppSrv01
rmdir /s /q ..\profiles\AppSrv01
manageprofiles.bat -create -templatePath ..\profileTemplates\default -profileName AppSrv01 -profilePath ..\profiles\AppSrv01

manageprofiles.bat 文件结尾为:

set RC=%ERRORLEVEL%
@endlocal & exit /b %RC%

当在我的批处理文件的第二行中删除配置文件时出现错误(这种情况经常发生),manageprofiles.bat 会吐出一条错误消息并导致我的批处理文件终止。我不希望发生这种情况,因为我将在下一个命令中删除配置文件的其余部分。阅读有关 exit 的文档让我相信 manageprofiles.bat 中 exit 命令中的/b 应该只会导致 manageprofiles.bat 终止而不影响我的 bat 文件。

我不想以任何方式触及 manageprofiles.bat 文件,因为我的更改可能会在以后的更新中恢复并再次破坏我的脚本。我可以在我的批处理文件中做些什么来解决这个问题吗?

最佳答案

将两次出现的“manageprofiles.bat”更改为“call manageprofiles.bat”。如果没有“调用”,执行将转移到 manageprofiles.bat 文件但不会返回。

关于windows - 你如何拥有一个被调用的 bat 文件而不杀死它正在调用的 bat 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1002830/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com