2017-07-18 100 views
0

摇篮高管:在Windowsgradle这个Exec的:找不到命令

找不到命令
task runTest(type: Exec) { 
    workingDir "$buildDir/test" 
    commandLine 'test.bat' 
} 

错误:

Caused by: java.io.IOException: Cannot run program "test.bat" (in directory 
"e:\foo\build\test"): CreateProcess error=2, The system cannot find the file 
specified 

但test.bat的是目录下。我可以去目录,然后运行命令手动

回答

0

能不能请你:

task runTest(type: Exec) { 
    workingDir "$buildDir/test" 
    commandLine 'cmd', '/c', 'test.bat' 
} 

docs

+0

谢谢。有用。 – Sunnyday