I got a script to ping servers which I used to execute going to the path where my file is located on CMD and type the following line
FileName ip logname.log
this is the script I run
hostIp = wscript.arguments(0)
logfilename = wscript.arguments(1)
Set fso = CreateObject("Scripting.FileSystemObject")
Set Shell = CreateObject("Wscript.Shell")
' OpenTextFile Method requires a Const value
' (Over)Write = 2 Append = 8
Set logfile = fso.OpenTextFile(logfilename, 8, True)
shellstring = "%comspec% /c ping -t -f -l 32 -w 1000 " & hostIP
Set oExec = Shell.Exec(shellstring)
wscript.echo "Ping Error log With Timestamp - Ctrl + C to halt"
Do While oExec.StdOut.AtEndOfStream <> True
pingline = Date & " " & Time & " " & oExec.StdOut.ReadLine
' If InStr(pingline, "TTL=") = 0 Then
logfile.WriteLine(pingline)
' End If
Loop
however, it doesn't work anymore whenever I execute it now it opens the file instead of executing it. any ideas on how to fix this issue?
cscript
from the command line. I.e.cscript <filename> <ip> <log>
what is filename extension? Is it .vbs? You may have changed your file associations somehow.