2013-09-27 45 views
0

我建立一个DOS批处理文件(或命令批处理文件,而),它看起来像这样内:执行可执行一个bat文件后,从我的批处理文件

@echo off 

set REGKEY=HKLM\Software\Adonix\X3RUNTIME\x3v6 
set REGVAL=ADXDIR 

REM query the value. pipe it through findstr in order to find the matching line that has the value. only grab token 3 and the remainder of the line. %%b is what we are interested in here. 

set VALUE= 
for /f "tokens=2,*" %%a in ('reg query %REGKEY% /v %REGVAL% ^| findstr %REGVAL%') do (
set myDir=%%b 
) 

%myDir%\bin\env.bat 

Adonix.exe -v 
pause 

出于某种原因,这个脚本在%myDir%\bin\env.bat行之后停止执行;我不知道为什么。

我希望它运行adonix -v行,但它不。实际上,如果您在env.bat文件后面放置了echo,它仍然不会运行。

有没有办法运行env.bat文件(它只是为路径运行一堆SET命令),让它执行那些设置命令,然后再运行adonix.exe?为什么在env.bat之后停止运行?

+3

解决方法是使用 调用%myDir%\ bin \ env.bat –

回答

4

您必须使用call才能从批处理文件运行另一个批处理文件,并希望将控制传回给您。