Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Folders & Shortcuts Losing Custom Icons On Removable Flash Drive

25 Oct 2014   #1
TheDeerDude

Windows 7 Home Premium (x64)
 
 
Folders & Shortcuts Losing Custom Icons On Removable Flash Drive

Hello once more,

I've recently dedicated one of my USB flash drives to use as a drive with all the basic, necessary programs (N++, Unlocker, etc.) which I install on my computers after a fresh OS installation. So, to speed up the process of doing so, instead of having to download all the programs, I keep them on my USB flash drive.

I'm a rather organized person, and here's what my problemes are, using an example.
There's a removable flash drive with letter F:
On it, there is a folder called "Recuva".
Inside that folder, there is the installer, an icon, desktop.ini file and a shortcut (.url) to recuva's download page.

My initial issue was that when I changed the icon for the folder "Recuva", and plugged the drive in on another computer, the icon wasn't there. It's desktop.ini that causes it to not show, because it provides full path to the icon, with the drive letter that can be different on other computers. I have managed to overcome that issue by using "IconResource=\Recuva\recuva.ico" instead of "IconResource=F:\Recuva\recuva.ico" but it's a very time consuming process to have to change it manually for 60 folders. Is there any other solution to this?

I'm also having the same issue with my shortcuts (.url) files. Because of the same reason. I tried opening them with notepad (which surprisingly worked) but removing the drive letter only caused them to show a blank or default icon rather than the custom one.

I know it doesn't have any impact on usability. I can still install programs and open shortcuts from that flash drive, yet I'd like it to look neat.

Any help for this eye-candy-addict will be appreciated


My System SpecsSystem Spec
.
25 Oct 2014   #2
Shimshom

Windows 7 Ultimate x64
 
 

Do you keep normal installers to install on your desktop/laptop or portables so you can just run it from the USB stick. Either way if you customize the icons using icons on your desktop computer then as soon as you unplug the USB the icons will not work on another computer. Rather then have the desktop.ini if you already have the customized icon you need in each folder just right click the folder and choose Properties then Customize, Change Icon and point it to the icon in that folder and you can do the same for your URL shortcuts. As long as you have the icons you want on the USB drive itself it should stay the same. You can probably delete the Desktop.ini all together. Not sure if there's a way to do it all at once but maybe one of the gurus here will have a better ideas
My System SpecsSystem Spec
25 Oct 2014   #3
TheDeerDude

Windows 7 Home Premium (x64)
 
 

I doubt that it matters, but I do keep installers as well as portables on the pendrive, here are some facts to clear things up:
Each installer has its own folder on in the main directory ("F:\" in my case)
Each of the folders contains an installer, an icon (.ico file) and a web shortcut (.url)
The icons I'm using to customize each folder are in each folder (Recuva's icon is in "F:\Recuva\")

And I did exactly what you've told me, to get to this point. As far as I know the "desktop.ini" is the configuration file for the folder its in, and it is necessary because it tells Windows Explorer to use a custom icon. Web shortcuts do not have such file because the location of their icons are within themselves.

The issue here is that different computers assign a different drive letter to my removable flash drive, causing all the icons not to work.

The fix that allows me to use custom icons for folders on the drive no matter what the drive letter is, is to remove the "F:" from desktop.ini file in each folder, and that isn't a problem, I was just wondering if there's a faster or easier way to do it rather than doing it manually. However, doing the same thing to my shortcuts (.url) doesn't work.

Either way, thank you for your reply, I appreciate it.
My System SpecsSystem Spec
.

26 Oct 2014   #4
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Hi Viper,

Basically you're asking for a script to remove "F:" in the IconResource line in every desktop.ini that exists on your USB (F:\) drive.

So here it is:

[Revision1]
Code:
@echo off
setlocal EnableDelayedExpansion
REM Locate all desktop.ini\s in F:\ and replace instances of 
REM "F:" with "" in the IconResource line in each desktop.ini
:: don\'t change these
set tempfold=%TEMP%\%~n0
set tempfile=%TEMP%\%~n0\%~nx0.tmp
::
set desktop.ini=desktop.ini
set find=F:
set replace=
::
cd /d "%~d0"
if EXIST "%TEMPFILE%" ( del "%TEMPFILE%" )
if EXIST "%TEMPFOLD%" ( rd "%TEMPFOLD%" )
md "%TEMPFOLD%"
for /f "delims=" %%I in (' dir /s /a /b "%DESKTOP.INI%" ') do (
 copy NUL "!TEMPFILE!" >NUL
 echo.&echo ^<INPUT^>&echo.
 for %%X in ( %%I ) do ( set destpath=%%~dpX& set destpath=!DESTPATH:~0,-1!)
 attrib "%%I" -R -S -H
 for /f "tokens=1* delims=]" %%L in (' find /n /v "" ^<"%%~I" ') do (
  echo.%%M
  if "%%M" == "" ( echo.>>"!TEMPFILE!") else (
   set line=%%M
   if "!LINE:~0,12!" == "IconResource" (
    echo #TRUE >NUL
    set line=!LINE:%FIND%=%REPLACE%!
    echo !LINE!>>"!TEMPFILE!"
   ) else (
    echo !LINE!>>"!TEMPFILE!"
   )
  )
 )
echo.&echo ^</INPUT^>&echo.
rename "!TEMPFILE!" "%DESKTOP.INI%"
set tempfile=%TEMP%\%~n0\%DESKTOP.INI%
replace "!TEMPFILE!" "!DESTPATH!" /r
echo.&echo ^<OUTPUT^>&echo.
type "!TEMPFILE!"
echo.&echo ^<OUTPUT^>&echo.
attrib "!DESTPATH!\%DESKTOP.INI%" +S +H
if EXIST "!TEMPFILE!" ( del "!TEMPFILE!" )
)
if EXIST "!TEMPFOLD!" ( rd "!TEMPFOLD!" )
goto :eof
Simply place the batch script anywhere on your USB and run.

Note: File attributes will not be preserved. All desktop.ini\s will be changed to a System Hidden file.



Edit: The script in this thread is depreciated. Please see Script wriring help (Attn: Pyprohly) for a better version.


Attached Files
File Type: bat thread_no-350048.bat (1.3 KB, 9 views)
My System SpecsSystem Spec
26 Oct 2014   #5
TheDeerDude

Windows 7 Home Premium (x64)
 
 

@Pyprohly:
Now, that is truly wonderful! Thank you so much. That'll come in handy, definitely. It completely solves my first problem with the folders' icons. I'll be keeping that, and using it regularly. It'll save me a lot of time .

Once I figure out what should go in each shortcut (.url) in order for it to display its set icon (removing "F:" doesn't do the trick for .urls unfortunately) then I'll be able to modify your script and use it for that purpose too, again, thank you for saving me so much time.
My System SpecsSystem Spec
26 Oct 2014   #6
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Most Welcome.

I've revised and fixed up a few lines in the script; mostly just indentation adjustments for readability and also lines that should have been removed that were used for debugging purposes. (appologies about 'desk.txt'; glad you got it to work despite my mistake .)

When doing a repetitive task on a computer 'by hand', know that there is probably a better way of accomplishing it.
My System SpecsSystem Spec
26 Oct 2014   #7
TheDeerDude

Windows 7 Home Premium (x64)
 
 

Thank you, it is indeed easier to understand now. I did some programming in batch a while ago, and while I don't quite understand what some of parts of your code do, it was obvious to spot the little mistake. That's what I was seeking - an easy way to do a repetitive task, again, thank you.

I shall continue to try to get the shortcuts (.url) to keep their custom icons if the drive's letter changes. So far - no luck.
My System SpecsSystem Spec
Reply

 Folders & Shortcuts Losing Custom Icons On Removable Flash Drive




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Removable Flash Drive Recognized as a Local Disk and not a Flash Drive
I recently purchased a 32 GB San Disk Flash Drive. The security files pre-installed on the drive were junk, and I could not delete them so I formatted the drive to remove them. This cleaned the disk, and it holds data, but I'm not sure if this is part of my problem. I am trying to load my copy of...
Hardware & Devices
Lost USB HD & Flash drives' custom icons.
Hi, Most recently, the custom icons I made for my USB HDs & Flash Ds have disappeared even though I reloaded the original Icons & on the drives several times. I have viewed a solution on the W7 forum at Drive Icon Change. However it seemed to apply only to icons originally included with...
Customization
"send to" menu showing hard/removable drive shortcuts
when i edit the "send to" folder in my user profile the shortcuts are not listed. i have file menu tools installed and under the send to section they don't show up either. i searched google for the location of the "send to" folder in the registry but, google is not my friend . i also searched here...
General Discussion
Custom drive icons
First of all it's not mine creation I just modified it to 3d to side Because I own WD there is a 3 version of it clear, black, blue. ( 16px-256px-png) WDHDD.rar Update with skined hdd's + dvd WDHDD-2.rar
Customization
No custom Hard drive icons
I just noticed today that on my external harddrive my WD Icon no longer shows up. I haven't changed the file and I have even made one for a different harddrive and that doesn't show up either. Just the default drive icon Any ideas?
Customization
Removable Media Shortcuts
How To Place Removable Media Shortcuts in Windows 7 This will show you how to place a temporary Shortcut on the Desktop for Removable Media This shortcut will appear when you plug in your device, and disappear when you remove it. It does NOT work like regular shortcuts, which remain on the...
Tutorials


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 02:03.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App