Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing text from autoexec.bat path

Status
Not open for further replies.

PcAddicTs

MIS
Apr 11, 2002
5
0
0
US
I am trying to remove a dirty install of Oracle from our win 98/95 pc's, so a newer version (path = c:\oracle\bin) can be installed. I need to remove the string "c:\orawin95\bin" from the path, but leave the rest of the string for the other apps.
I am new to VBS, and I am having trouble finding any help on
string removal.
Can anyone help?

Jeff
 
you will probably have to open the file for reading, read a line and then at the same time write a line to a new file.
when you come across the line you want to replace, write a different line

file2Open = strDestDrive & "FujitsuSiemens\SystemArchitect\V6.0_PatchTemplate\_SCRIPT\ATO-SystemArchitect_V6.0_Patch27-ml.ini"
file2Create = strDestDrive & "FujitsuSiemens\SystemArchitect\V6.1_Patch" & strPatchVersion & "_ML\_SCRIPT\ATO-SystemArchitect_V6.1_Patch" & strPatchVersion & "-ml.ini"

If FSO.FileExists(file2Open) Then
Set tsIni = FSO.OpenTextFile(file2Open)
Else
'Wscript.Echo "cant find source notes.ini"
End If

'cmd /c FSCDRIVE%\FujitsuSiemens\SystemArchitect\V6.0_Patch27_ML\_SCRIPT\ATO-SystemArchitect_V6.0_Patch27-ml.ini

Set newInifile = fso.CreateTextFile(file2Create, True)

Do While Not tsIni.AtEndOfStream
sLine = Trim(tsIni.ReadLine)
'msgbox sLine
If sLine = "ProductV=6.0_Patch27" Then
'msgbox "found the " & sLine
sLine = "ProductV=6.1_Patch" & strPatchVersion
'msgbox "now it is " & sLine
End If
'msgbox sLine
If sLine = "IExe=FujitsuSiemens\SystemArchitect\V6.0_Patch27_ML\_SCRIPT\install.vbs" Then
'msgbox "found the " & sLine
sLine = "IExe=FujitsuSiemens\SystemArchitect\V6.1_Patch" & strPatchVersion & "_ML\_SCRIPT\install.vbs"
'msgbox "now it is " & sLine
End If

If sLine = "RegT1Val=6.0.0.27" Then
'msgbox "found the " & sLine
sLine = "RegT1Val=6.1.0." & strPatchVersion
'msgbox "now it is " & sLine
End If

newInifile.WriteLine sLine
Loop

tsIni.Close
newInifile.Close
Set tsIni = nothing
Set newInifile = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top