diff --git a/build-cmd.sh b/build-cmd.sh
index bd8cca6b2937cde912740949ffa596b314c85a2d..c7b24f1919d8d9963e349cd4711e458a2d859e09 100755
--- a/build-cmd.sh
+++ b/build-cmd.sh
@@ -5,14 +5,14 @@ set -x
 # make errors fatal
 set -e
 
-if [ "$OSTYPE" = "cygwin" ] ; then
-    export AUTOBUILD="$(cygpath -u $AUTOBUILD)"
-fi
-
 if [ -z "$AUTOBUILD" ] ; then 
     fail
 fi
 
+if [ "$OSTYPE" = "cygwin" ] ; then
+    export AUTOBUILD="$(cygpath -u $AUTOBUILD)"
+fi
+
 # load autbuild provided shell functions and variables
 set +x
 eval "$("$AUTOBUILD" source_environment)"