Commit 196fb10c authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

cmd.exe: for loop by default only matches files.

parent 54d890ca
......@@ -593,6 +593,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
WCHAR variable[4];
WCHAR *firstCmd;
int thisDepth;
BOOL isDirs = FALSE;
/* Check:
the first line includes the % variable name as first parm
......@@ -667,10 +668,15 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
hff = FindFirstFile (item, &fd);
if (hff != INVALID_HANDLE_VALUE) {
do {
thisCmdStart = cmdStart;
WINE_TRACE("Processing FOR filename %s\n", wine_dbgstr_w(fd.cFileName));
WCMD_part_execute (&thisCmdStart, firstCmd, variable,
fd.cFileName, FALSE, TRUE);
BOOL isDirectory = (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
if ((isDirs && isDirectory) ||
(!isDirs && !isDirectory))
{
thisCmdStart = cmdStart;
WINE_TRACE("Processing FOR filename %s\n", wine_dbgstr_w(fd.cFileName));
WCMD_part_execute (&thisCmdStart, firstCmd, variable,
fd.cFileName, FALSE, TRUE);
}
} while (FindNextFile(hff, &fd) != 0);
FindClose (hff);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment