dinoldo
Cadet 4th Year
- Registriert
- Juni 2017
- Beiträge
- 104
Hallo Leute,
ich habe eine VBS-Datei, die beim Start direkt blitzschnell geschlossen wird. Habt ihr eine Idee, woran es bitte liegen könnte?
Besten Dank im Voraus!
Gruß Dino
ich habe eine VBS-Datei, die beim Start direkt blitzschnell geschlossen wird. Habt ihr eine Idee, woran es bitte liegen könnte?
Code:
Option Explicit
Dim currentLine
Dim fso, txtFile, newFileContent
Dim shell
Dim element, Msg
Dim location(5)
const file = "\Standards\data\"
const vbsInterpreter = "cscript.exe"
const CheckFile = "\Standards\config\system\config.cfg"
Set shell = CreateObject("WScript.Shell")
Call ForceConsole
Set fso = CreateObject("Scripting.FileSystemObject")
Set txtFile = fso.OpenTextFile("P:\Standort\Hamburg" & file & "nova.cfg", 1)
currentLine = txtFile.ReadLine()
newFileContent = CStr(Val(currentLine) + 1)
txtFile.Close()
Set txtFile = fso.OpenTextFile("P:\Standort\Hamburg" & file & "nova.cfg", 2)
txtFile.Write newFileContent
txtFile.Close()
location(0) = "P:\Standort\Hamburg"
location(1) = "P:\Standort\Berlin"
location(2) = "P:\Standort\Köln"
location(3) = "P:\Standort\Düsseldorf"
location(4) = "P:\Standort\Kiel"
location(5) = "P:\Standort\Mänchen"
WScript.StdOut.WriteLine "Erreichbarkeit vom Server wird geprüft! Bitte warten..."
WScript.Sleep 50000
For Each element In location
If Len(element) > 0 Then
If Not fso.FileExists(element & CheckFile) Then Msg = Msg & vbLf & element
End If
Next
WScript.StdOut.WriteLine ""
If Msg <> vbNullString Then
If MsgBox("Folgende Standorte sind nicht ereichbar:" & vbLf & Msg & vbLf & vbLf & "Weitermachen?", vbQuestion Or vbYesNo, "Fehler") = vbNo Then WScript.Quit
End If
For Each element In location
If Len(element) > 0 Then
If fso.FileExists(element & CheckFile) Then
WScript.StdOut.WriteLine "Bearbeitet wird: " & element & file
fso.CopyFile "P:\Standort\Hamburg" & file & "nova.cfg", element & file, True
End If
End If
Next
Sub ForceConsole()
If InStr(LCase(WScript.FullName), vbsInterpreter) = 0 Then
shell.Run vbsInterpreter & " //NoLogo " & Chr(34) & WScript.ScriptFullName & Chr(34)
WScript.Quit
End If
End Sub
Besten Dank im Voraus!
Gruß Dino