gradle Exec:找不到命令

gradle Exec:找不到命令,gradle,exec,Gradle,Exec,Gradle exec:在windows上找不到该命令 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 sys

Gradle exec:在windows上找不到该命令

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在目录下。我可以转到目录并手动运行命令

请尝试:

task runTest(type: Exec) {
    workingDir "$buildDir/test"
    commandLine 'cmd', '/c', 'test.bat'
}
就像在电影里一样