Sky
Sky

Reputation: 7691

How to use cmd command in Gradle?

I tried several ways found online, but have same exception below:

 Process 'command 'cmd'' finished with non-zero exit value 1

Following is my build script:

files.each { File file ->
        if (file.isFile()) {
            println " *** $file.name ***"
            exec {
                commandLine "cmd", "/c", "native2ascii", "$file.name", "$file.name"
            }
        }
    }
println " ==== Encoding done === "

Upvotes: 4

Views: 6487

Answers (1)

Mithun
Mithun

Reputation: 8067

Change the exec block as follows:

exec {
    commandLine "cmd", "/c native2ascii $file.name $file.name"
}

Upvotes: 2

Related Questions