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
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
there are some samples in the \WiseScript Editor\Samples directory, have you checked those out?
Answered 01/18/2007 by: aogilmor
Ninth Degree Black Belt

Please log in to comment
0
Yes I already look at theses samples and none of them can do what I need
Answered 01/18/2007 by: BuRsT
Senior Yellow Belt

Please log in to comment
0
look at the textfile.wse, it'll do that with a little tweaking.

if that doesn't work for you, vbscript has some search/replace capability, thogh it can be a little cumbersome.
Answered 01/18/2007 by: aogilmor
Ninth Degree Black Belt

Please log in to comment
0
You can cut and paste the below code into your script to see what I did. The purpose of the following script was used to create a batch file which would run a set of commands, then output to a logfile %username%.log.

If you need more insight into this, please feel free to post your email address and I'll reply.


item: Remark
Text===== FLOPPY DRIVE CHECK ====
end
item: Delete File
Pathname=%TEMP%\Floptst.bat
end
item: Install File
Source=.\vbs\flpytst.vbs
Destination=%TEMP%\flpytst.vbs
Flags=0000000010000010
end
item: Insert Line into Text File
Pathname=%TEMP%\Floptst.bat
New Text=@ECHO OFF
Line Number=0
end
item: Insert Line into Text File
Pathname=%TEMP%\Floptst.bat
New Text=C:
Line Number=0
end
item: Insert Line into Text File
Pathname=%TEMP%\Floptst.bat
New Text=CD \
Line Number=0
end
item: Insert Line into Text File
Pathname=%TEMP%\Floptst.bat
New Text=CD %TEMP%
Line Number=0
end
item: Insert Line into Text File
Pathname=%TEMP%\Floptst.bat
New Text=chkdsk a: >%TEMP%\%USERNAME%-flop.LOG
Line Number=0
end
breakpoint item: Insert Line into Text File
Pathname=%TEMP%\Floptst.bat
New Text=cscript flpytst.vbs >>%TEMP%\%USERNAME%-flop.LOG
Line Number=0
end
item: Insert Line into Text File
Pathname=%TEMP%\Floptst.bat
New Text=exit
Line Number=0
end
item: Execute Program
Pathname=cmd.exe
Command Line=/c %TEMP%\floptst.bat
Default Directory=%TEMP%
Flags=00001010
end
item: Insert Line into Text File
Pathname=%TEMP%\%USERNAME%-flop.LOG
New Text=
Search Text=Microsoft (R) Windows Script
Line Number=0
Flags=00101010
end
item: Insert Line into Text File
Pathname=%TEMP%\%USERNAME%-flop.LOG
New Text=[FLOPPY INFO]
Search Text=Copyright (C) Microsoft
Line Number=1
Flags=00001010
end
item: Insert Line into Text File
Pathname=%TEMP%\%USERNAME%.LOG
New Text=
Search Text=Status=
Line Number=0
Flags=00110010
end
item: Remark
Text===== END OF FLOPPY CHECK ====
end
Answered 01/23/2007 by: Secondlaw
Third Degree Blue Belt

Please log in to comment
Answer this question or Comment on this question for clarity