mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 10:33:48 +00:00
Don't expand FOR variables until execution time, so that special characters in them won't cause unwanted syntactic effects.
For example, "for %a in (^>) do echo %a" should just echo the greater than sign. svn path=/trunk/; revision=39611
This commit is contained in:
parent
a5d9170830
commit
9b0334da19
5 changed files with 64 additions and 24 deletions
|
@ -405,19 +405,14 @@ LPTSTR ReadBatchLine ()
|
|||
}
|
||||
|
||||
/* At this point, fv points to parameter string */
|
||||
bc->forvalue = fv;
|
||||
|
||||
/* Double up % signs so they will get through the parser intact */
|
||||
while (*sp)
|
||||
{
|
||||
if ((*sp == _T('%')) && (*(sp + 1) == bc->forvar))
|
||||
{
|
||||
/* replace % var */
|
||||
dp = _stpcpy (dp, fv);
|
||||
sp += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Else just copy */
|
||||
*dp++ = *sp++;
|
||||
}
|
||||
if (*sp == _T('%'))
|
||||
*dp++ = _T('%');
|
||||
*dp++ = *sp++;
|
||||
}
|
||||
|
||||
*dp++ = _T('\n');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue