1. Create a new text document anywhere. Rename it to something suitable like "Hide DS_Store Files.bat" any name is fine as long as you change the extension from .txt to .bat If you get a prompt about changing the file extension choose 'yes' to rename it.
2. Right click on the file and select "Edit"
3. Paste the following code into the text editor, save and exit. If your windows installation is on a drive other than C:\ then replace C: with the appropriate drive name.
Attrib +h +s C:\*.DS_Store /s ExitIf you have multiple drives you would like to hide files on then create an entry for each. Likewise, if there are other file types you would like to hide, add entries for each:
Attrib +h +s C:\*.DS_Store /s Attrib +h +s D:\*.DS_Store /s Attrib +h +s C:\*._* /s Attrib +h +s D:\*._* /s Exit(WARNING* if you do something silly like "Attrib +h +s C:\*.* /s" don't complain to me when all of your files disappear *WARNING)
4. Double click on the .bat file to run the script, a command window will pop up. It might look like it isn't doing anything or has crashed, but don't worry. The script is searching every file on your C: drive for .DS_Store files to hide, this can take a long time.
5. New .DS_Store files might be created from time to time that won't be hidden any more. When this happens, just run the script again.
If you messed up and need to see the files you hid, in the Explorer menu bar, go to Tools - > Folder Options... in the box that pops up, click on the "View" tab and under the "Advanced Options" menu make sure the box next to "Hide protected operating system files(recommended)" is unchecked.
So what did we do?
"attrib" runs the DOS program attrib.exe which is used for changing file and folder attributes much in the same way that file permissions work in OSX.
This batch script tags all the .DS_Store files on the designated drive(s) with the Hidden "+h" and System "+s" attributes. This categorizes them as superhidden files and they will not show up in explorer or searches like regular hidden files and folders that have the "+h" attribute but are missing "+s".
* acts as a wildcard so "C:\*._*" will work on "C:\._MyDoc.doc" "C:\._YourDoc.doc" "C:\DoNotHide._" "C:\DoNotHide._MyDoc.doc" etc...
the "/s" command at the end tells the script to perform the attribute change on all the subfolders in C:\ so it will look in "C:\", "C:\Windows", "C:\My Documents", "C:\Program Files", etc. and all the folders in those folders. In effect, it checks every single file and folder on the C:\ drive.