WiseScript - Need a script for replacing a string
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
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
Answers (4)
Please log in to answer
Posted by:
aogilmor
17 years ago
Posted by:
BuRsT
17 years ago
Posted by:
aogilmor
17 years ago
Posted by:
Secondlaw
17 years ago
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
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
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.