Here's a no-frills script that will prompt you to select a folder. It will then copy the first .jpg found and name that copy folder.jpg. It will then do the same for all subfolders.
Copy the following into notepad and save with a .vbs extension.
-----------------------------------------------------------
Const SHCONTF_FOLDERS = &H20
Const SHCONTF_NONFOLDERS = &H40
dim oXpShell, oWshShell, oFso, oFolder
'Assign objects
Set oXpShell = CreateObject("Shell.Application")
Set oWshShell = CreateObject("WScript.Shell")
Set oFso = CreateObject("Scripting.FileSystemObject")
set oFolder = oXpShell.BrowseForFolder(0, "Choose a Folder", 0)
If oFolder Is Nothing Then WScript.Quit
SetPic oFolder
Msgbox "Done"
Sub SetPic(oFolder)
set oSubFolderItems = oFolder.Items
oSubFolderItems.Filter SHCONTF_NONFOLDERS, "*.jpg"
If oSubFolderItems.Count > 0 Then
PicPath = oSubFolderItems.Item(0).Path
On Error Resume Next
oFso.CopyFile PicPath, oFolder.Self.Path & "\folder.jpg", False
On Error Goto 0
End If
set oSubFolderItems = oFolder.Items
oSubFolderItems.Filter SHCONTF_FOLDERS, "*"
For each oSubFolder in oSubFolderItems
If oSubFolder.IsFolder Then
SetPic oSubFolder.GetFolder
End If
Next
End Sub
-----------------------------------------------------------------------
Keith
LOL. I think I misread the question myself. The method I describe will display one picture by default, but the same picture for every folder. I thought it was an odd request, but who am I to judge.
On re-reading, I see the OP wants one image from the containing folder to be the thumbnail for that folder.
I don't know how to change the default behavior of thumbnail generation, so I think this would require a script of some sort. I'll give it some thought.
Keith
Save the following as a .reg file, changing the path to the picture accordingly. The double backslashes will become single when you merge the reg file:
-------------------------------------------------------
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\Bags\AllFolders]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\Bags\AllFolders\Shell]
"Logo"="C:\\Documents and Settings\\Keith\\My Documents\\My Pictures\\testbkgrnd.bmp"
---------------------------------------------
This will change the thumbnail for all folders that don't have an assigned picture. To clear out the rest of the pictures:
c:\>del /s folder.jpg
c:\>del /a /s thumbs.db
The only folder pictures remaining should be those which were assigned thru the customize dialog. To remove those, you can use the dialog or use regedit to delete the "Logo" value in each numbered subkey of:
"HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\Bags"
Good Luck,
Keith
Flippy Smith said:
First, please don't respond to this post with "just go to 'Customize This Folder
and select a picture for the folder". That is exactly what I want to do, but I
want it to be DEFAULT for all folders when I use thumbnail view. I have
thousands of folders and it would be impossible to customize every one of them.
I don't use thumbnail view by default, but in my picture folders I want to use
thumbnail view. XP by default displays four thumbnails on a folder icon which
is basically useless to me because they're too small to see. When I switch to
thumbnail view I want explorer to display ONE thumbnail on a folder icon by
default, without having to customize thousands of folders manually or put a
folder.jpg into each folder manually.
If anyone can figure this out I'd really appreciate the solution!
TIA