diff --git a/w32/subproc/misc.c b/w32/subproc/misc.c
index 96e43ae..1a3ae9f 100644
--- a/w32/subproc/misc.c
+++ b/w32/subproc/misc.c
@@ -20,7 +20,42 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <string.h>
 #include <windows.h>
 #include "proc.h"
+#include "debug.h"
 
+/*
+ * Return the Win OS-version.
+ *
+ * According to:
+ *   http://msdn.microsoft.com/en-us/library/windows/desktop/ms682653(v=vs.85).aspx
+ *
+ * "... Windows Server 2003 and Windows XP:  The maximum size of the environment
+ *    block for the process is 32,767 characters. Starting with Windows Vista and Windows
+ *    Server 2008, there is no technical limitation on the size of the environment block."
+ *
+ * So we need to check for Win-XP or lower before giving any warning on the
+ * maximum env-size.
+ */
+static DWORD get_win_version (void)
+{
+  static DWORD os_version = 0x0400;   /* defaults to Win-NT 4.0 */
+  static int done = 0;
+  OSVERSIONINFO ovi;
+
+  if (done)
+     return (os_version);
+
+  done = 1;
+  memset (&ovi, 0, sizeof(ovi));
+  ovi.dwOSVersionInfoSize = sizeof(ovi);
+
+  if (GetVersionEx(&ovi) && ovi.dwPlatformId == VER_PLATFORM_WIN32_NT)
+     os_version = (WORD)(ovi.dwMajorVersion << 8) + (WORD)ovi.dwMinorVersion;
+
+  /* If the above is FALSE (Win-9x/ME?), we fall-back to Win-NT which also
+   * has the limitation of 32kB env-block sizes.
+   */
+  return (os_version);
+}
 
 /*
  * Description:  Convert a NULL string terminated UNIX environment block to
@@ -62,6 +97,10 @@ arr2envblk(char **arr, char **envblk_out)
 	}
 	size_needed++;
 
+	if (ISDB(DB_JOBS) && get_win_version() < 0x0600 && size_needed > 32*1024) {
+		DB (DB_JOBS, ("Size of environment is %d bytes. Subprocess may fail mysteriously.\n",
+		              size_needed));
+	}
 	qsort((void *) tmp, (size_t) arrcnt, sizeof (char*), compare);
 
 	ptr = *envblk_out = calloc(size_needed, 1);
