Open Multiple Windows System Files With One Click


1. You are on a windows platform.
2. You have Windows Scripting (WSH) enabled.
3. You have no security issues running VBS scripts.

The following code will pull up several system files in notepad all in one place. Save this code into a text file and then rename the extension to .vbs for it to become executable. Modify it to take out or add more by changing what is in the array. For example, taking out everything except the hosts file from the array will mean only the hosts file will be opened in notepad:

Set Sh = WScript.CreateObject("WScript.Shell")
On Error Resume Next
sOStype = Sh.RegRead(_
If Err.Number <> 0 Then
  Wscript.Echo " This doesn't appear to be an NT-like operating system;" _
  & vbcrlf & "on Win9x use sysedit or msconfig."
  Set FSO = CreateObject("Scripting.FileSystemObject")
  dirConfPath = "%SYSTEMROOT%\System32\"
  fileset=Array("config.nt","autoexec.nt","drivers\etc\hosts", _
    "drivers\etc\lmhosts","drivers\etc\networks", _
  On Error Resume Next
  For Each configfile In fileset
    Sh.Run "Notepad " & dirConfPath & configfile
End If


What's Next?

Did you enjoy this article? Help spread the word by sharing:

Join the Northway Navigator Club today and get access to restricted content including our best tips and tricks. Membership is free! You will also receive free email updates by registering.

Engage in the conversation and leave a comment:

Scott Moore

About Scott Moore (153 articles)

With over 20 years of IT experience with various platforms and technologies, Scott has tested some of the largest applications and infrastructures in the world. He is a Certified Instructor and Certified Product Consultant in HP’s LoadRunner and Performance Center products. He currently holds HP certifications for ASE, ASC, and CI. A thought leader in the APM space, he speaks regularly at IT conferences and events

  • Manni King

    thank you.

    Best regards.