Results 1 to 2 of 2

Thread: [RESOLVED] Help Needed for vbscript!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2006
    Posts
    28

    Resolved [RESOLVED] Help Needed for vbscript!

    Hi guys,

    i'm looking for a vbscript.

    i want to update the host file with new one without deleting the contents.
    can anyone help me?

    there is 3 host file i want to make it one host file.

    Kindly help me.

    im new im not sure how to do it. still learning.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Dec 2006
    Posts
    28

    Re: Help Needed for vbscript!

    Here is the vbscript but it doesnt work anymore can anyone help me?

    vb Code:
    1. Option Explicit
    2. Dim ObjShell
    3. If WScript.Arguments.length = 0 Then
    4. Set ObjShell = CreateObject("Shell.Application")
    5. ObjShell.ShellExecute "wscript.exe", """" & _
    6. WScript.ScriptFullName & """" &_
    7. " RunAsAdministrator", , "runas", 1
    8. Else
    9. 'Code here
    10. Dim wshShell, fileSys, oProcEnv, sTemp, sDir, sFile, Source, Target, curPath
    11. '---------------------------------
    12. 'Set objShell = CreateObject("Shell.Application")
    13. Set wshShell = WScript.CreateObject("WScript.Shell")
    14. Set fileSys = CreateObject("Scripting.FileSystemObject")
    15. Set oProcEnv = wshShell.Environment("PROCESS")
    16. sTemp = oProcEnv("Temp")
    17. 'curPath = fileSys.GetAbsolutePathName(".")
    18. '---------------------------------
    19. '---------------------------------
    20. On Error Resume Next
    21. sFile = "hosts"
    22. 'Source = curPath & "\Logs\" & sfile
    23. sDir = wshShell.ExpandEnvironmentStrings("%system32%\drivers\etc\")
    24. Source = sFile
    25. Target = sDir & sFile
    26. 'Target  = curPath & "\Logs\" & sfile
    27. fileSys.CopyFile (Source), (Target)
    28. 'fileSys.DeleteFile(Source)
    29. Set fileSys = nothing
    30. End If

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width