How to execute a command in windows cmd using Gradle?
Asked Answered
R

1

8

I am trying to execute this command using Gradle .

.\build\build.exe parse /p 246 /o ".\strings.xml.bcg" /novalidate /l 1033 /sr "@LbaRoot@\settings\default\lss\default.config" "..\app\src\main\res\values\strings.xml"

This works fine when I execute in command Line. I am trying to replicate the behaviour using Gradle

    task runLSBuild(type:Exec) {
    workingDir '../outer_build'

    //on windows:
    commandLine '.\\build\\build.exe','parse /p 246 /o ".\\strings.xml.bcg" /novalidate /l 1033 /sr "@LbaRoot@\\settings\\default\\lss\\default.config" "..\\app\\src\\main\\res\\values\\strings.xml"'
}

But this fails with error ".\build\build.exe", The system cannot find the file specified. I need to run the program with working directory as outer_build.

Any suggestions on where am I going wrong ?

Rearward answered 31/8, 2015 at 15:56 Comment(1)
bad workingDir maybeVeliz
R
14

Ok I got the issue . Looks like for windows, we have to write like this

     task runLSBuild(type:Exec) {
    workingDir '../outer_build'

    //on windows:
    commandLine "cmd","/c",'.\\build\\build.exe parse /p 246 /o ".\\strings.xml.bcg" /novalidate /l 1033 /sr "@LbaRoot@\\settings\\default\\lss\\default.config" "..\\app\\src\\main\\res\\values\\strings.xml"'
}
Rearward answered 31/8, 2015 at 16:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.