Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
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 '10 at 6:28
    
I want to toggle the Show hidden files and folders setting. –  Oq. Mar 11 '10 at 6:34
1  
does it require some kind of refresh to the folder view (like f5)? –  Matthew Lock Mar 11 '10 at 6:51
    
Never hurts to include it in the script would it? Goo point though @Matthew –  Ivo Flipse Mar 11 '10 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 '10 at 7:04
show 3 more comments

2 Answers

up vote 3 down vote accepted

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
share|improve this answer
add comment

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
share|improve this answer
    
thanks will test it. For Win7 I used "Send {F5}", and it worked. For XP I used "PostMessage, 0x111, 28931,,, A" –  Oq. Jan 4 '11 at 6:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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