Archive: How do I unhide then hide files during install?


How do I unhide then hide files during install?
In one of the steps I need to unhide files (visible in their folder during install) then unhide them.

I found a registry key that does that and it works but only if the user logs off and logs on again - which stop the execution of my installer.

I noticed that in windows xp in folder options when you select hide/unhide and press the apply button this happen immediately without having to logoff/logon. How do they do that?

Can I do something similar in NSIS?


Don't mess with the users explorer settings!


Thanks Anders for your advice. It is good in general but in my special case I need this for an internal company application.

If I can't do this via NSIS I will have to find a way to do this via win32 API.

I tried ${RefreshShellIcons} but this doesn't help.

Any ideas?


You would have to refresh every explorer window, you can probably do that with COM (CLSID_ShellWindows/IID_IShellWindows)

See http://blogs.msdn.com/oldnewthing/ar...20/188696.aspx for more


hmm...
Maybe instead of messing with the user's explorer settings, you could simply change the file/folder attributes to remove and then set the "hidden" flag?

My thought is that perhaps you could just use attrib.exe (which I believe is included with all Windows installation). Or you might find a plugin or API call to do the same.

edit
:o yes, SetFileAttributes should work. (Thanks Anders). I knew I read that somewhere; go figure it'd be in the NSIS help file!


Originally posted by Comperio
My thought is that perhaps you could just use attrib.exe (which I believe is included with all Windows installation). Or you might find a plugin or API call to do the same.
SetFileAttributes