 |
Doctor Deploy: software deployment, - distribution, repackaging, msi, windows installer, client management, installation, setup : forum - discussion boards
|
| Author |
Message |
BuRsT
Piccolo

Joined: 18 Jan 2007
Posts: 2
Location: Montreal, Quebec
|
Posted:
Thu, 18.Jan.2007, 17:11 |
 |
Hello there.
I hope you can help me.
I need to replace a string in a batch file with a value in INSTALLDIR
The build-in function "Insert Line into Text file" replace the whole line instead of the selected string.
Any1 of you made a custom script to do this kind of operation ?
thanks |
|
|
  |
 |
Dominik Oberlin
Melchior

Joined: 29 May 2006
Posts: 29
|
Posted:
Thu, 18.Jan.2007, 20:42 |
 |
Hello BuRsT
The Action "Insert Line into text File" means, that you must insert a whole line. But you can append the not variable part in "Text to insert" field.
Set the match criteria to "Line containing Search Text" and insert action to "replace containing text".
Copy following part (example), paste it in WiseScript Package Editor and replace the filename, text to Search & replace.
| Code: |
item: Insert Line into Text File
Pathname=MyTestFile.TXT
New Text=this text was added before: %TEMP% and this text was added after
Search Text=this text was added before:
Line Number=0
Flags=00101000
end |
|
|
|
  |
 |
BuRsT
Piccolo

Joined: 18 Jan 2007
Posts: 2
Location: Montreal, Quebec
|
Posted:
Thu, 18.Jan.2007, 21:27 |
 |
Doesn't work
Here an example :
I want to replace "FILENAME" by "DOCS" in this file.bat :
COPY C:\test\FILENAME.txt C:\test2\testfile.txt
after the string replace, it should be :
COPY C:\test\DOCS.txt C:\test2\testfile.txt
If I use the "Insert Line into Text File" with the setting you post, the whole line is replace by "DOCS" |
|
|
  |
 |
Dominik Oberlin
Melchior

Joined: 29 May 2006
Posts: 29
|
Posted:
Fri, 19.Jan.2007, 08:48 |
 |
And here is an other WiseScript example. (No, it not replace the whole line with "DOCS"):
| Code: |
item: Set Variable
Variable=FILEBODY
Value=DOCS
end
item: Insert Line into Text File
Pathname=file.bat
New Text=COPY C:\test\%FILEBODY%.TXT C:\test2\testfile.txt
Search Text=FILENAME
Line Number=0
Flags=00101000
end |
|
|
|
  |
 |
|
|
|
|
|
View next topic
View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Service provided by flatbyte.com
::
Powered by phpBB
:: FI Theme
:: Imprint ::
All times are GMT + 1 Hour
| |