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(_ "HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType") 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." Else Set FSO = CreateObject("Scripting.FileSystemObject") dirConfPath = "%SYSTEMROOT%\System32\" fileset=Array("config.nt","autoexec.nt","drivers\etc\hosts", _ "drivers\etc\lmhosts","drivers\etc\networks", _ "drivers\etc\protocol","drivers\etc\services") On Error Resume Next For Each configfile In fileset Sh.Run "Notepad " & dirConfPath & configfile Next End If
Did you enjoy this article? Help spread the word by sharing:
Engage in the conversation and leave a comment:
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