Hello,

In my script (see below) I try cleanup the autoexec.bat of Win98 machines. First I read line by line the autoexec and write those lines that do not contain the word "path" to an new file. All goes wel in this part. Then I read the system variable %path% and split it based on the separator ";" and put the value's in to an array. The values within the array are checked and if they match they my conditions they will be written to the new autoexec file.
This works unless the path segment value, between the ";" seperators, is quoted.
I like the script to work for those parts as well.
Then

Case based on the fact that oracle is installed in C:\oracle:
If the old sitiuation =
Path="C:\test1";c:\test2;C:\oracle\bin;C:\windows\system

The result based on this script is now:

Path=c:\test2;C:\windows\system

Desired result should be:

Set Path="C:\test1";c:\test2;C:\windows\system

Used script:
Code:

Function WshPipe($ShellCMD, OPTIONAL $NoEcho)
Dim $oExec, $Output
$oExec = CreateObject("WScript.Shell").Exec($ShellCMD)
If NOT VarType($oExec)=9 $WshPipe="WScript.Shell Exec Unsupported" Exit 10 EndIf
While NOT $oExec.Status Loop
$Output = $oExec.StdOut.ReadAll + $oExec.StdErr.ReadAll
If NOT $NoEcho $Output EndIf
$WshPipe=Split($Output,Chr(10))
Exit($oExec.ExitCode)
EndFunction

Break On
$autoexec = "C:\autoexec.bak"
$newautoexec = "C:\autoexec.new"
$regkey = "HKEY_LOCAL_MACHINE\Software\Oracle"
If KeyExist ($regkey)
$ORAhome = ReadValue ($regkey, "ORACLE_HOME")
$sElement=Split($ORAhome,"\")
If $sElement[0]="C:"
DelTree ($regkey)
Shell '%COMSPEC% /C deltree /y $ORAhome'
If Open(1,$autoexec) = 0
While @ERROR = 0
$record = ReadLine(1)
If NOT @error
If $record
If NOT InStr($record,Path)
? $record
$ = Open(3,$newautoexec,5)
$ = WriteLine(3,$record + Chr(13) + Chr(10) )
EndIf
EndIf
EndIf
Loop
$ = WriteLine(3,"Set Path = ")
EndIf
$segment = Split("%path%",";")
For $i = 0 To Ubound($segment)
? $segment[$i]
If NOT InStr($segment[$i],$ORAhome)
$ = WriteLine(3,$segment[$i])
$ = WriteLine(3,";")
EndIf
Next
EndIf
EndIf
$ = Close(3)
:END
? ? Exit



Thanks