edit variable of parent batch file from secondary batch file


29 观看


77 作者的声誉

a.bat is parent batch file b.bat is secondary batch file which is started by a.bat like this:

start b.bat

If I "start b.bat" from a batch file a.bat, b.bat can access all variables defined in a.bat, but it can't edit the variables of a.bat.Is there any way so b.bat can edit a variable defined in a.bat...i s this possible with batch scripts?

作者: Abhi 的来源 发布者: 2017 年 12 月 27 日

回应 1


39344 作者的声誉


start starts a new context (derived from the current one). Any changes (to variables) will be lost, when the started process is finished. Use call b.bat to stay in the same context. (unless you use setlocal in b.bat)

作者: Stephan 发布者: 2017 年 12 月 27 日