In bash I can write this:
#!/bin/sh
ant debug && adb install -r bin/Rocher-debug.apk
But I have a similar windows batch file, and currently it does this:
ant debug
adb install -r bin/Rocher-debug.apk
So, if "ant debug" fails, it will still run "adb install," and that's not ideal. Do any of you guys know how to do an && equivalent in this situation?
I really have to sit down and properly learn windows scripting some day soon, since I'll be doing a lot of windows work in a few months. But for now a quick answer would be awesome :-)
EXE files are different from BAT files since they contain executable binary data rather than plain text commands. They are stored in the Portable Executable (PE) format. The EXE file format includes various headers and sections that tell Windows how to run a program.
In cmd.exe the &&
operator should work essentially the same way, provided your program returns error codes correctly.
ant debug && adb install -r bin/Rocher-debug.apk
Should work.
You can test this the following way:
ant debug
echo %errorlevel%
If this returns zero when it succeeded and non-zero otherwise, then you can use the exact same &&
that you use in bash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With