Open err redirection the same as output redirection.  Batch file does not need to be opened with FILE_FLAG_WRITE_THROUGH since it is read only, catch by thomas.
Modified: trunk/reactos/subsys/system/cmd/batch.c
Modified: trunk/reactos/subsys/system/cmd/cmd.c

Modified: trunk/reactos/subsys/system/cmd/batch.c
--- trunk/reactos/subsys/system/cmd/batch.c	2005-08-20 18:07:59 UTC (rev 17450)
+++ trunk/reactos/subsys/system/cmd/batch.c	2005-08-20 18:30:25 UTC (rev 17451)
@@ -221,7 +221,7 @@
 	SetLastError(0);
 	hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE, NULL,
 			    OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
-				 FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_WRITE_THROUGH, NULL);	
+				 FILE_FLAG_SEQUENTIAL_SCAN, NULL);	
 
 #ifdef _DEBUG
 	DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\')  hFile = %x\n"),

Modified: trunk/reactos/subsys/system/cmd/cmd.c
--- trunk/reactos/subsys/system/cmd/cmd.c	2005-08-20 18:07:59 UTC (rev 17450)
+++ trunk/reactos/subsys/system/cmd/cmd.c	2005-08-20 18:30:25 UTC (rev 17451)
@@ -796,9 +796,9 @@
       }
       
       out[size]=_T('\0');
-      hFile = CreateFile (out, GENERIC_WRITE, FILE_SHARE_WRITE, &sa,
+      hFile = CreateFile (out, GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE, &sa,
 		                    (nRedirFlags & OUTPUT_APPEND) ? OPEN_ALWAYS : CREATE_ALWAYS,
-		                    FILE_ATTRIBUTE_NORMAL, NULL);
+		                    FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH, NULL);
 
      if (hFile == INVALID_HANDLE_VALUE)
      {
@@ -858,10 +858,10 @@
 		{
 			hFile = CreateFile (err,
 			                    GENERIC_WRITE,
-			                    0,
+			                    FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
 			                    &sa,
 			                    (nRedirFlags & ERROR_APPEND) ? OPEN_ALWAYS : CREATE_ALWAYS,
-			                    FILE_ATTRIBUTE_NORMAL,
+			                    FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH,
 			                    NULL);
 			if (hFile == INVALID_HANDLE_VALUE)
 			{