|
If you ever use the network configuration files on Windows NT/2000/XP, you
may find yourself wishing for something similar to the SysEdit tool for working
with the "special" configuration files. Every time you need to edit
a file, you need to remember where it is, then navigate down to %SYSTEMROOT%\System32\drivers\etc
and open it.
Sure would be nice to have a one-click tool to open the files instantly, wouldn't
it?
It's easy to "roll your own" using WSH (Windows Scripting Host).
Below is a script I put together to do exactly this. Just save it as a VBS (Visual
Basic Script) file, and you have instant editing access to the files.
'Netedit.vbs
'NT network config file editing made easy
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 does not 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
|