[CMD] FOR: Some functionality is available only when extensions are enabled.

This is basically all the advanced functionality enabled with the /D,
/R, /L and /F flags, and the usage of enhanced variables.
This commit is contained in:
Hermès Bélusca-Maïto 2020-07-12 23:07:23 +02:00
parent fedc68aea8
commit 41a93a4e58
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 26 additions and 12 deletions

View file

@ -500,19 +500,27 @@ ExecuteFor(PARSED_COMMAND *Cmd)
Cmd->For.Context = lpNew;
fc = lpNew;
if (Cmd->For.Switches & FOR_F)
/* Run the extended FOR syntax only if extensions are enabled */
if (bEnableExtensions)
{
Ret = ForF(Cmd, List, Buffer);
}
else if (Cmd->For.Switches & FOR_LOOP)
{
Ret = ForLoop(Cmd, List, Buffer);
}
else if (Cmd->For.Switches & FOR_RECURSIVE)
{
DWORD Len = GetFullPathName(Cmd->For.Params ? Cmd->For.Params : _T("."),
MAX_PATH, Buffer, NULL);
Ret = ForRecursive(Cmd, List, Buffer, &Buffer[Len]);
if (Cmd->For.Switches & FOR_F)
{
Ret = ForF(Cmd, List, Buffer);
}
else if (Cmd->For.Switches & FOR_LOOP)
{
Ret = ForLoop(Cmd, List, Buffer);
}
else if (Cmd->For.Switches & FOR_RECURSIVE)
{
DWORD Len = GetFullPathName(Cmd->For.Params ? Cmd->For.Params : _T("."),
MAX_PATH, Buffer, NULL);
Ret = ForRecursive(Cmd, List, Buffer, &Buffer[Len]);
}
else
{
Ret = ForDir(Cmd, List, Buffer, Buffer);
}
}
else
{