Welcome!

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

SignUp Now!

Can't get my TPIPE /replace to work

Jun
137
3
I've got a file called CreateISO.ibb that contains the following (along with a lot more, but for now this is good enough):

IBB

[START_BACKUP_OPTIONS]
BuildInputMode=1
BuildOutputMode=2
Destination=
DataType=0
FileSystem=1

I executed the command (all on one line)

tpipe /input=%TEMP%\CreateISO.ibb /replace=0,0,0,0,0,0,0,0,0,Destination=,Destination=%_DEST% /output=%TEMP%\CreateISO.ibb

I expected that this would take the line that had an empty Destination= string and replace it with Destination= followed by the value of the _DEST environment variable, which I've confirmed is non-empty (_DEST='c:\VESTA Analytics 3.1 (3.1.75.0).iso'). But the file is unchanged. I thought that maybe it was a file in, file out, overwriting kind of issue, so I tried using /output=%TEMP%\CreateISO.ibb.new, but this file was an exact copy of the original.

What am I doing wrong, and how do I fix it?
 
Notice that your variable's value contains spaces. I think you'll have to quote it:
Code:
tpipe /input=%TEMP%\CreateISO.ibb /replace=0,0,0,0,0,0,0,0,0,Destination=,Destination="%_DEST" /output=%TEMP%\CreateISO.ibb

But your file looks pretty much like an .INI file to me. It might be simpler to use @INIWRITE.
 
I agree that it looks like an INI file. Doesn't that first line, with no brackets around it (IBB), disqualify it from using @INIWRITE? Well, I'll be gobsmacked :sorry: it works! I guess I'll go with that!

But as a learning exercise, to the first point, I've modified the code in the batch file prior to the TPIPE call so that _DEST no longer has any single quotes around it, and I used %@quote[%_DEST] instead of hard-coding quotes in your statement above. But it still does nothing.
 
I copied your IBB example text into a file named foo.ibb and set _dest=foo
I ran TPIPE with the output sent to the console:
Code:
tpipe /input=foo.ibb /replace=0,0,0,0,0,0,0,0,0,"Destination=","Destination=%_DEST"
IBB

[START_BACKUP_OPTIONS]
BuildInputMode=1
BuildOutputMode=2
Destination=foo
DataType=0
FileSystem=1

So Destination did get replaced. What does your _DEST environment variable contain?
Also, variables in TCC use a single percent sign - e.g. %_DEST vs %_DEST%
 
Thanks for your response, Scott.

I copied your IBB example text into a file named foo.ibb and set _dest=foo

...

So Destination did get replaced. What does your _DEST environment variable contain?

_DEST=c:\VESTA Analytics 3.1 (3.1.75.0).iso

Also, variables in TCC use a single percent sign - e.g. %_DEST vs %_DEST%

True. I was taking an original .bat file, making significant changes, and was in the habit of following the convention required for CMD.

At this point, I believe the issue is that the single backslash has to be replaced by two, since it appears that regular expression processing is interfering. I will probably also have to backslash the parends. But given that I have a new thread (and the followup here was really a learning exercise), I think I will abandon this one and continue with that one. Thanks for the help!
 

Similar threads

Back
Top