Check to see if a folder or file is already there when makign a folder.  Set correct errorlevel when fail to create folder. fixes bug 868.
Modified: trunk/reactos/subsys/system/cmd/En.rc
Modified: trunk/reactos/subsys/system/cmd/internal.c
Modified: trunk/reactos/subsys/system/cmd/resource.h

Modified: trunk/reactos/subsys/system/cmd/En.rc
--- trunk/reactos/subsys/system/cmd/En.rc	2005-10-04 14:31:11 UTC (rev 18265)
+++ trunk/reactos/subsys/system/cmd/En.rc	2005-10-04 14:56:38 UTC (rev 18266)
@@ -571,6 +571,7 @@
 STRING_CHOICE_ERROR,         "Invalid option. Expected format: /C[:]options"
 STRING_CHOICE_ERROR_TXT,     "Invalid option. Expected format: /T[:]c,nn"
 STRING_CHOICE_ERROR_OPTION,  "Illegal Option: %s"
+STRING_MD_ERROR,			 "A subdirectory or file ass already exists.\n"
 STRING_CMD_ERROR1,           "Can't redirect input from file %s\n"
 STRING_CMD_ERROR2,           "Error creating temporary file for pipe data\n"
 STRING_CMD_ERROR3,           "Can't redirect to file %s\n"

Modified: trunk/reactos/subsys/system/cmd/internal.c
--- trunk/reactos/subsys/system/cmd/internal.c	2005-10-04 14:31:11 UTC (rev 18265)
+++ trunk/reactos/subsys/system/cmd/internal.c	2005-10-04 14:56:38 UTC (rev 18266)
@@ -433,7 +433,7 @@
 	LPTSTR place;	/* used to search for the \ when no space is used */
 	LPTSTR *p = NULL;
 	INT argc;
-
+	nErrorLevel = 0;
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{
 		ConOutResPaging(TRUE,STRING_MKDIR_HELP);
@@ -479,10 +479,17 @@
 	if (_tcslen (dir) >= 2 && dir[_tcslen (dir) - 1] == _T('\\'))
 		dir[_tcslen(dir) - 1] = _T('\0');
 
+	if(IsExistingDirectory(dir) || IsExistingFile(dir))
+	{
+		ConErrResPuts(STRING_MD_ERROR);
+		freep(p);
+		nErrorLevel = 1;
+		return 1;
+	}
 	if (!CreateDirectory (dir, NULL))
 	{
 		ErrorMessage (GetLastError(), _T("MD"));
-
+		nErrorLevel = 1;
 		freep (p);
 		return 1;
 	}

Modified: trunk/reactos/subsys/system/cmd/resource.h
--- trunk/reactos/subsys/system/cmd/resource.h	2005-10-04 14:31:11 UTC (rev 18265)
+++ trunk/reactos/subsys/system/cmd/resource.h	2005-10-04 14:56:38 UTC (rev 18266)
@@ -220,6 +220,7 @@
 #define STRING_EXPECTED_NUMBER_OR_VARIABLE 722
 #define STRING_SYNTAX_COMMAND_INCORRECT    723
 #define STRING_RMDIR_HELP2				   724
+#define STRING_MD_ERROR					   725
 
 
 /* These strings are language independent (cmd.rc) */