Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Problem with %var:find=replace% syntax

May
603
0
The syntax %var:find=replace% does not appear to work when the variable is
an internal variable.

TCC 10.00.48 Windows XP [Version 5.1.2600]
TCC Build 48 Windows XP Build 2600 Service Pack 3


D:\test>echo %_cwd
D:\test

D:\test>set zzz=%_cwd

D:\test>echo %_cwd:test=qqqq% %zzz:test=qqqq%
D:\test D:\qqqq

--
Jim Cook
2009 Saturdays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Sunday.
 
On Thu, Feb 5, 2009 at 8:25 AM, JP Software Forums <[email protected]> wrote:


> The syntax %var:find=replace% does not appear to work when the variable is
> an internal variable.
>
> TCC 10.00.48 Windows XP [Version 5.1.2600]
> TCC Build 48 Windows XP Build 2600 Service Pack 3
>
>
> D:\test>echo %_cwd
> D:\test
>
> D:\test>set zzz=%_cwd
>
> D:\test>echo %_cwd:test=qqqq% %zzz:test=qqqq%
> D:\test D:\qqqq
>

It appears _some_ internal variables are not affected, but some are.

D:\test>set zzz=%CD%

D:\test>echo %CD% .. %_CWD% .. %ZZZ%
D:\test .. D:\test .. D:\test

D:\test>echo %CD:test=qqqq% .. %_CWD:test=qqqq% .. %ZZZ:test=qqqq%
D:\qqqq .. D:\test .. D:\qqqq


--
Jim Cook
2009 Saturdays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Sunday.
 
On Thu, 05 Feb 2009 10:25:47 -0600, Jim Cook <> wrote:


>The syntax %var:find=replace% does not appear to work when the variable is
>an internal variable.

Did you expect it to work? I wouldn't.
 
<[email protected]>
It appears _some_ internal variables are not affected, but some are.

D:\test>set zzz=%CD%

D:\test>echo %CD% .. %_CWD% .. %ZZZ%
D:\test .. D:\test .. D:\test

D:\test>echo %CD:test=qqqq% .. %_CWD:test=qqqq% .. %ZZZ:test=qqqq%
D:\qqqq .. D:\test .. D:\qqqq

That makes sense to me. That nasty syntax is only there for compatibility with CMD.EXE, which does not support TC's internal variables -- but does have a few of its own, including CD.

If you're writing for TC, you can and should use @REPLACE instead.

</[email protected]>
 
>
>
> ---Quote---
> >The syntax %var:find=replace% does not appear to work when the variable is
> >an internal variable.
> ---End Quote---
> Did you expect it to work? I wouldn't.
>


Well, yes. That's why I reported it.

Especially since %CD% does work but %_CWD% does not -- I find that very
odd.

--
Jim Cook
2009 Saturdays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Sunday.
 
Back
Top
[FOX] Ultimate Translator
Translate