Jump to content
Macro Express Forums

Toggle Show/hide Hidden Folders


Recommended Posts

I want to write 2 macros, to Hide and Show hidden folders. Or

preferably one macro that would toggle the setting.


Is there a way to do this more elegant than recording mouse moves and

clicks? I can't seem to find "Folder Options" as a Control Panel




Link to comment
Share on other sites

Hello Andy!


There is a Macro Express command named File Attributes (Files/Folders category) that can be used to set or reset file attributes. I thought that it worked on folders, too. And it sort of does. If you place a folder name in the Filename field (and set the Attribute choices) then any files and folders within the target folder will be set accordingly ... but not the folder name itself.




An alternative is to use the Windows Run command dialog. Like this:

Run Dialog Window: Run Programs
Wait For Window Title: "Run"
Text Type: attrib +h c:\foldera\subfolder1
Text Type: <ENTER>
Wait Window Lose Focus: "Run"
Macro Return

The above example would set the subfolder1 folder to hidden, but leave everything else within it untouched. If you need to know how to use the DOS attrib command then do the following:

  1. Engage the windows Run dialog
  2. Type "cmd" or "command" without the quotes, then hit <Enter>
  3. From the DOS window type in "attrib /?" without the quotes, then hit <Enter>

You will see the acceptable command line arguments for the DOS attrib command. To close the DOS window, just type "exit" without the quotes, then hit <Enter>.

Link to comment
Share on other sites



Thanks, but I didn't explain myself well. I wasn't looking for a way to

change file attributes.


What I want to do is toggle Windows Explorer showing or not showing

hidden files, thru the Folder Options dialog box, the View tab.


You can get to Folder Options either thru the Control Panel, or in an

individual folder thru Tools>Folder Options (even though the View tab

changes things globally).



Link to comment
Share on other sites



A quick google search and experiment with Explorer and Regedit turned up the this. When the Tools | Folder Options | View | "Do not show hidden files and folders" radio button is clicked the registry value 'Hidden' in the registry key:



changed from 1 to 2. Similarly when the the Tools | Folder Options | View | "Show hidden files and folders" radio button is clicked the registry value 'Hidden' changed from 2 to 1.


Using this information you could write a macro that uses the 'Write Registry Integer' command to change this registry value.


I did not check to see if this was the only registry value that changed so some testing and experimenting may be needed.

Link to comment
Share on other sites

  • 1 year later...

I think I posted this one other time, but here's one that works good:

If Not Program Name "EXCEL.EXE" running

Program Launch: "EXCEL.EXE"

Variable Set Integer %N1% to 1

Write Registry Integer: ""

Macro Stop

End If

Read Registry Integer: "State"

Variable Set String %T1% "Microsoft Excel"

If Variable %N1% = 0

Window Show: "%T1%"

Activate Window: "%T1%"

Variable Modify Integer: %N1% = %N1% + 1

Write Registry Integer: "State"


Window Hide: "%T1%"

Variable Modify Integer: %N1% = %N1% + -1

Write Registry Decimal: "State"

End If


Registry value would be something like:


You could program its creation but since you only need create it once, just regedit, add value DWORD "State" or whatever you want to call it.

Attach it to a hotkey.

What it does:

If program not running, runs it (you don't need to activate it, just have it maximized or normal)

If running and visible, hides it.

If running and not visible, shows it.

It will not appear in the taskbar or system tray so you just have to know it's there.

If you don't want it to open on top, leave out the "activate"

If you're not comfortable putting something in the registry, you could do it other ways but this is completely safe in CURRENT_USER keys.

I've got a bunch of these because I just don't like my taskbar cluttered with stuff I know is around.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...