diff --git a/reactos/base/shell/cmd/batch.c b/reactos/base/shell/cmd/batch.c index 30cdbae62ad..1f7c5fbe245 100644 --- a/reactos/base/shell/cmd/batch.c +++ b/reactos/base/shell/cmd/batch.c @@ -285,6 +285,7 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd /* Echo batch file line */ if (bEcho && Cmd->Type != C_QUIET) { + ConOutChar(_T('\n')); PrintPrompt(); EchoCommand(Cmd); ConOutChar(_T('\n')); @@ -292,15 +293,9 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd bc->current = Cmd; ExecuteCommand(Cmd); - if (bEcho && !bIgnoreEcho && Cmd->Type != C_QUIET) - ConOutChar(_T('\n')); FreeCommand(Cmd); - bIgnoreEcho = FALSE; } - /* Don't print a newline for this command */ - bIgnoreEcho = TRUE; - TRACE ("Batch: returns TRUE\n"); return TRUE; diff --git a/reactos/base/shell/cmd/parser.c b/reactos/base/shell/cmd/parser.c index 7692afad83b..537712f2362 100644 --- a/reactos/base/shell/cmd/parser.c +++ b/reactos/base/shell/cmd/parser.c @@ -522,12 +522,22 @@ error: return NULL; } +/* Parse a REM command */ +static PARSED_COMMAND *ParseRem(void) +{ + /* Just ignore the rest of the line */ + while (CurChar && CurChar != _T('\n')) + ParseChar(); + return NULL; +} + static PARSED_COMMAND *ParseCommandPart(void) { TCHAR ParsedLine[CMDLINE_LENGTH]; TCHAR *Pos; DWORD TailOffset; PARSED_COMMAND *Cmd; + PARSED_COMMAND *(*Func)(void); REDIRECTION *RedirList = NULL; int Type; @@ -595,8 +605,9 @@ static PARSED_COMMAND *ParseCommandPart(void) TailOffset = Pos - ParsedLine; /* Check for special forms */ - if (_tcsicmp(ParsedLine, _T("for")) == 0 || - _tcsicmp(ParsedLine, _T("if")) == 0) + if ((Func = ParseFor, _tcsicmp(ParsedLine, _T("for")) == 0) || + (Func = ParseIf, _tcsicmp(ParsedLine, _T("if")) == 0) || + (Func = ParseRem, _tcsicmp(ParsedLine, _T("rem")) == 0)) { ParseToken(0, STANDARD_SEPS); /* Do special parsing only if it's not followed by /? */ @@ -608,7 +619,7 @@ static PARSED_COMMAND *ParseCommandPart(void) FreeRedirection(RedirList); return NULL; } - return _totlower(*ParsedLine) == _T('f') ? ParseFor() : ParseIf(); + return Func(); } Pos = _stpcpy(Pos, _T(" /?")); }