ICU-20858 Fix Windows data build failure with long paths
diff --git a/icu4c/source/python/icutools/databuilder/renderers/common_exec.py b/icu4c/source/python/icutools/databuilder/renderers/common_exec.py
index 838b121..3623441 100644
--- a/icu4c/source/python/icutools/databuilder/renderers/common_exec.py
+++ b/icu4c/source/python/icutools/databuilder/renderers/common_exec.py
@@ -120,12 +120,15 @@
     # If the command line length on Windows exceeds the absolute maximum that CMD supports (8191), then
     # we temporarily switch over to use PowerShell for the command, and then switch back to CMD.
     # We don't want to use PowerShell for everything though, as it tends to be slower.
-    if (platform == "windows") and (len(command_line) > 8190):
-        if verbose:
-            print("Command length exceeds the max length for CMD on Windows, using PowerShell instead.")
+    if (platform == "windows"):
         previous_comspec = os.environ["COMSPEC"]
-        os.environ["COMSPEC"] = 'powershell'
-        changed_windows_comspec = True
+        # Add 7 to the length for the argument /c with quotes.
+        # For example:  C:\WINDOWS\system32\cmd.exe /c "<command_line>"
+        if ((len(previous_comspec) + len(command_line) + 7) > 8190):
+            if verbose:
+                print("Command length exceeds the max length for CMD on Windows, using PowerShell instead.")
+            os.environ["COMSPEC"] = 'powershell'
+            changed_windows_comspec = True
     if verbose:
         print("Running: %s" % command_line)
         returncode = subprocess.call(