2017-07-18 101 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