Problem with %var:find=replace% syntax

May 20, 2008
603
0
Sammamish, WA
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.
 
May 20, 2008
603
0
Sammamish, WA
On Thu, Feb 5, 2009 at 8:25 AM, JP Software Forums <neil@jpsoft.com> 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.
 
May 20, 2008
11,438
99
Syracuse, NY, USA
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.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,470
88
Albuquerque, NM
prospero.unm.edu
<NEIL@JPSOFT.COM>
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.

</NEIL@JPSOFT.COM>
 
May 20, 2008
603
0
Sammamish, WA
>
>
> ---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.
 
Similar threads
Thread starter Title Forum Replies Date
Alpengreis TCC-Option for EnableDelayedExpansion (!var!) problem Support 15
D Minor problem. Incorrect value internal var _dir_files Support 7
N Problem with 'do <var> /L ....' and spaces Support 6
Dick Johnson Weird Color Problem Support 8
fishman@panix.com Problem with 27.15 Support 2
M Problem with VSDevCmd.bat in VS 16.7.3 Support 0
R Problem with @INT[ value] in V26 Support 9
M Selecting test "off by one" problem in Take command Support 4
Alpengreis UTF-8 problem in TCC related to Python Support 7
K_Meinhard Small problem in german IDE 26 Support 3
B Problem with color in nested shells Support 1
Joe Caverly Problem creating and switching to a DESKTOP Support 9
vefatica Another popup problem Support 10
Alpengreis ffind dialog (/W) problem Support 4
Alpengreis [TCMD v25.00.24] Small space problem with the DE translation in Prefs-GUI Support 1
Alpengreis [TCMD v25.00.24] Problem with copy and paste and the # char via mouse in TCC Support 6
A Problem with functions @int @decimal and identifying Powershell as a shell. Support 12
B IF command problem in tcexit.btm Support 9
fishman@panix.com Problem at Startup of TCC Support 3
P Problem with SFTP copies Support 7
P Problem with FTP copies Support 10
Jay Sage Problem with Context Menu Copy+Paste+Run Key Assignment Support 7
R Problem with %_do_loop in nested do loops Support 2
fishman@panix.com New Problem with later Windows 10 Support 10
Peter Murschall A little problem with LEAVE and COMMENT Support 5
M Handling of %~I problem Support 4
WinLanEm FOR problem Support 18
K Problem With SCRPUT /u Support 3
vefatica What's TCMD's problem with ^e[0m? Support 13
Peter Murschall IDE: RTL with non-English resources-problem is back in Build 28 Support 4
rps Regex problem: \xnn not recognized as a hex character Support 0
rps PRIORITY LOW problem Support 1
old coot Regex problem: \xnn not recognized as a hex character Support 12
vefatica Another problem with build 22. Support 3
Alpengreis [23.x] Download-Problem Support 2
S Problem with " Support 3
C Problem navigating forums Support 11
x13 Problem listing repository files using DIR http(s)://... Support 8
Joe Caverly Problem with TEE in v22 Support 2
Alpengreis Problem with thousands delimiter and colors Support 17
M Take Command 18, migrating to another machine, license problem. Support 1
B TCC 21.01.50 Problem with ALIAS /r and SET /r Support 2
rps How to? @search problem Support 2
WinLanEm @SELECT problem Support 6
T Fixed Problem with use of Batch parameters in the IDE Support 1
Oz Solomon Problem with "list" Support 14
S V21.24 theme problem Support 2
Alpengreis Problem if command prompt is not legacy Support 4
Alpengreis TCMD.INI: The "super hidden" problem ... Support 6
G Odd problem - screen brightness Support 4

Similar threads