topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday April 16, 2024, 6:38 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: toggle hidden files with keyboard or button  (Read 3474 times)

mraeryceos

  • Participant
  • Joined in 2010
  • *
  • Posts: 41
    • View Profile
    • Donate to Member
toggle hidden files with keyboard or button
« on: April 05, 2019, 05:54 PM »
I have a lot of files and folders, and they are organized well, but some folders and files I rarely access because they are dated.  I don't want to move the old files, but keeping them mixed with the new files makes for clutter.  So I thought, how about having all the old files hidden?  That way I can still have them organized where they are, but not cause clutter with my present files.

So I'd like a keyboard shortcut, or a windows explorer button to toggle the showing of hidden files.

I'm still using Windows XP.  If you want to make it for a newer system, I'm sure someone will find it useful.

I sort of have this figured out.  I created a shortcut to a batch file, and placed the shortcut in "Links".  Then I turned on the "Links" toolbar in Windows Explorer.  Here's the batch file:
@ECHO OFF
set regpath=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
set regvalue=Hidden
set regdata=2
reg query "%regpath%" /v "%regvalue%" | find /i "%regdata%"

IF errorlevel 1 goto :hide
    Reg add "%regpath%" /v Hidden /t REG_DWORD /d 1 /f
    goto :end
:hide
    Reg add "%regpath%" /v Hidden /t REG_DWORD /d 2 /ff
:end
There is still a nuisance though.  The setting updates, but explorer does not refresh.  And it needs to be a particular kind of refresh.  F5 doesn't work.  What reliably works, is the refresh in the context-menu of the blank-space of the file-list.  How to get that to happen via a batch file is beyond me.

mraeryceos

  • Participant
  • Joined in 2010
  • *
  • Posts: 41
    • View Profile
    • Donate to Member
Re: toggle hidden files with keyboard or button
« Reply #1 on: April 05, 2019, 06:18 PM »
Don't really want to install a hotkeys program...
https://superuser.co...on-demand-in-windows

Guy that had same problem:
https://msfn.org/boa...ments#comment-362420

Here is a solution, which initiates a DLL from a command in the context menu (download named "HiddenFilesToggle_3.0_Setup.zip"):
https://www.sevenfor...files-menu-icon.html

I liked this solution the best.  Although it runs in the background, it accepts Winkey+H to toggle:
https://www.howtogee...tcut-key-in-windows/
« Last Edit: April 05, 2019, 07:00 PM by mraeryceos »

worstje

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 588
  • The Gent with the White Hat
    • View Profile
    • Donate to Member
Re: toggle hidden files with keyboard or button
« Reply #2 on: April 05, 2019, 06:48 PM »
I can't be bothered going down the rabbit hole, but there's two Windows APIs that come to mind. You'd need some tool that can actually create such API calls though because this is a bit lower-level than a batch file.

Option 1): SHChangeNotify() function. I am not sure if this will work when you change the setting to display hidden files since this API seems to be oriented more towards changes in the actual items displayed rather than the settings of Explorer, but the only way to find out is to test it. The SHCNE_ALLEVENTS flag is probably the safest bet, but it might cause it to refresh too much, so if that works, you'll probably want to narrow down exactly what changes.

Option 2) Broadcast a WM_SETTINGCHANGE message. This StackOverflow question shows an example on how to do this. However, this seems to be more geared towards generic system settings and not towards what Explorer is configured as. Still, it is worth a shot.

There might be more APIs that I am not aware of, but these two came to mind. I can't quite help you beyond this pointer, though.

mraeryceos

  • Participant
  • Joined in 2010
  • *
  • Posts: 41
    • View Profile
    • Donate to Member
Re: toggle hidden files with keyboard or button
« Reply #3 on: April 05, 2019, 07:01 PM »
Hi worstje.  I found a couple downloads that worked.  See post above yours.