Hallo Programmierer,
ich möchte aus der PATH-Variablen einen bestimmten Pfad => C:\Programme\Java\jre1.6.0_02\bin
Call removePathEntry("%Path%","C:\Programme\Java\jre1.6.0_02\bin")
Sub removePathEntry(argEnv,argEntry)
Dim shell,env,Path,arPathEntries,n,entry
WScript.echo "argEnv:",argEnv
WScript.echo "argEntry:", argEntry
Set shell = CreateObject("wscript.shell")
Set env = shell.environment("system")
Path = shell.ExpandEnvironmentStrings("%Path%")
WScript.echo argEnv,"before:",Path
arPathEntries = Split(Path,";")
For n = 0 To UBound(arPathEntries)
entry = arPathEntries(n)
If LCase(entry) = LCase(argEntry) Then
arPathEntries(n) = "C:\Programme\Java\jre1.6.0_02\bin"
ElseIf Trim(entry) <> "" Then
arPathEntries(n) = entry & ";"
Else
arPathEntries(n) = ""
End If
Next
Path = Join(arPathEntries,"")
WScript.echo argEnv," after:",Path
env("Path") = Path
End Sub
Leider will das Script noch nicht so wie ich es mir wünsche....sieht Jemand wo ich den ANFÄNGERFEHLER gemacht habe?