Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

VBS Log.txt weiter schreiben

Empfohlene Antworten

Veröffentlicht

Hallo Leute was muss ich machen damit die "Log.txt" nicht überschrieben sondern weiter geschrieben wird. ? Kann man auch bestimmen ob es drüber oder drunter geschrieben wird?

Hier mein Code:



Option Explicit


Dim Computername, Ping, Status, Datei, FSO


Set FSO= CreateObject("Scripting.FileSystemObject")	

	if FSO.fileexists("Log.txt") = True Then

		Set Datei = FSO.OpenTextFile("Log.txt", 2)

		Datei.AtEndofStream

		Datei.Write(Date &"|"& Time &" Skript wurde gestartet"+ VbCrlf)

			else

			Set Datei = FSO.CreateTextFile("Log.txt", True)

			Datei.Write(Date &"|"& Time &" Skript wurde gestartet 1"+ VbCrlf)

end if 



Computername = Inputbox ("Bitte geben Sie den Computernnamen an","Ping ...")



Set Ping = GetObject("winmgmts:{impersonationLevel=impersonate}")._ 

	ExecQuery("select * from Win32_PingStatus where address = '"_ 

	& Computername & "'") 


For Each Status in Ping 

	If IsNull(Status.StatusCode) Or Status.StatusCode <> 0 Then  

		Datei.Write(Date & "|" & Time &" Ping nicht erfolgreich ausgeführt !"+ VbCrlf)

		WScript.Echo "Computer " & Computername & " nicht erreichbar. Bitte melde Sie sich bei Ihrem Admin!" 



	Else

		Datei.Write(Date &"|"& Time &" Ping erfolgreich ausgeführt"+ VbCrlf)

		WScript.Echo "Computer " & Computername & " ist online."	 

	End If 

Next

WScript.Stdin.Readline

Datei.Write(Date &"|"& Time &" Skript beendet"+ VbCrlf)

asphelper.de - VBScript - OpenTextFile

ForAppending -> 8

an den dateibeginn geht nicht, das müsstest du selbst implementieren oder einen logmechanismus verwenden.

s'Amstel

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.