6

I would like to make use of a hotkey to toggle the Show hidden files and folders setting. I want to use it on both windowsXp and Windows7.

Here is what I got so far:

#h::
RegRead, Showall_Status, HKEY_LOCAL_MACHINE, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL, CheckedValue, 
If Showall_Status = 0
RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL, CheckedValue, 1 
Else
RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL, CheckedValue, 0
Return

Problem is when I run the script it simply does nothing. Not sure what I am missing.

8
  • Do you want to toggle the Show hidden files and folders setting, or toggle the hidden bit of a file/folder?
    – John T
    Mar 11, 2010 at 6:28
  • I want to toggle the Show hidden files and folders setting.
    – Oq.
    Mar 11, 2010 at 6:34
  • 1
    does it require some kind of refresh to the folder view (like f5)? Mar 11, 2010 at 6:51
  • Never hurts to include it in the script would it? Goo point though @Matthew
    – Ivo Flipse
    Mar 11, 2010 at 6:53
  • I suppose it does. I just tried adding- Send, {F5} - at the end. Yet it still just does nothing. I am on WinXP at the moment.
    – Oq.
    Mar 11, 2010 at 7:04

2 Answers 2

4

Ok, the problem was the regkey, this one works.

;------------------------------------------------------------------------
; Show hidden folders and files in Windows XP
;------------------------------------------------------------------------
; User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
; Value Name: Hidden
; Data Type: REG_DWORD (DWORD Value)
; Value Data: (1 = show hidden, 2 = do not show)

    #h::

        RegRead, ShowHidden_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
        if ShowHidden_Status = 2 
        RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
        Else
        RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
        WinGetClass, CabinetWClass
        PostMessage, 0x111, 28931,,, A
        Return
1
  • see below for win7...
    – jiggunjer
    Jan 17, 2016 at 16:09
3

I don't have enough points to reply, so I'm posting this as another answer...

The explorer won't refresh with the above PostMessage in win7. So you'll want both of these to work in XP and win7.

http://www.autohotkey.com/forum/topic1204.html

PostMessage, 0x111, 28931,,, A
PostMessage, 0x111, 41504,,, A
1
  • thanks will test it. For Win7 I used "Send {F5}", and it worked. For XP I used "PostMessage, 0x111, 28931,,, A"
    – Oq.
    Jan 4, 2011 at 6:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.