Mungo,
Thanks for your reply - I hope you didn't think I was being lazy or
something. I'm not a VBS/programmer guy at all; but like a lotta people
I can usually manage to modify someone's existing script for my
purposes without mucking things up too badly.
I had actually started to mod Kelly's "Show Hidden Folders" script, but
wasn't sure about one section of his code. Besides the key name and
some message boxes, the only real change needed was to change the
possible key values to 0 or 1, instead of 1 or 2.
It works fine except for one section I'm not clear on - maybe you or
someone else here can just help me with the "errnum <>1" part. Is the
purpose of this to set the key to a specific value if the key doesn't
already exist (or if some other error is returned)?
my code is below...
thanks,
JohnB
********************************************************************************
Message = "To work correctly, this script will close" & vbCR
Message = Message & "and restart the Windows Explorer shell." & vbCR
Message = Message & "This will not harm your system." & vbCR & vbCR
Message = Message & "Continue?"
X = MsgBox(Message, vbYesNo, "Notice")
If X = 6 Then
On Error Resume Next
On Error Resume Next
Dim WSHShell, n, p, itemtype, MyBox
Set WSHShell = WScript.CreateObject("WScript.Shell")
p =
"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden"
itemtype = "REG_DWORD"
n = WSHShell.RegRead (p)
errnum = Err.Number
if errnum <> 1 then
WSHShell.RegWrite p, 0, itemtype
End If
If n = 1 Then
WshShell.RegWrite p, 0, itemtype
MyBox = MsgBox("Protected Operating System Files and Folders are now
HIDDEN", 64, "Operating System Files and Folders")
End If
If n = 0 Then
WshShell.Regwrite p, 1, itemtype
MyBox = MsgBox("Protected Operating System Files and Folders are now
VISIBLE", 64, "Operating System Files and Folders")
End If
Set WshShell = Nothing
On Error GoTo 0
For Each Process in GetObject("winmgmts:"). _
ExecQuery ("select * from Win32_Process where name='explorer.exe'")
Process.terminate(0)
Next
MsgBox "Finished." & vbcr & vbcr , 4096, "Done"
Else
MsgBox "No changes were made to your system." & vbcr & vbcr, 4096,
"User Cancelled"
End If
********************************************************************************