I need to know how I can search for and delete icons on Windows xp devices. The files will be on the user's desktop but we have many different users on some of our devices. How can I tell the package to find all instances of the files no matter whose directory they are in and delete them. Any help would be greatly appreciated.
They are actually shortcuts
So something as simple as:
DEL /F /S /Q "C:\Documents and Settings\Your Shortcut.LNK"
Will delete all shortcuts called Your Shortcut. Run without /Q first to test.
As far as I know, there no way of telling Package Builder to loop through every userprofile and delete a file.
Batch might be your best best attempting a task like this. Try:
@for /D %%i in ("%ALLUSERSPROFILE%\..") do if exist "%%~fi\Desktop\foo.ico" del "%%~fi\Desktop\foo.lnk"
Please note this line needs to be in a .cmd file (or .bat if you're old-fashion) and not intended to be run directly from a commandline (in which case you will have to replace %%i for %i and %%~fi for %~fi).
Also, note that the path to Desktop has been hardcoded. It might not work if your computers have a non-english OS.
Thank you so very much for your help
>>> Zman <[email protected]> 4/15/2009 3:07 PM >>>
A new message was posted in the thread "Package Builder or whatever will work":
Author : Zman
Email : [email protected]
Correct about the hard coding but I don't think that there is a EV for C:\Documents and Settings\. Most sites redirect %HOMEPATH% to a network share. Starting at the root will get all lnks.
True! %ALLUSERPROFILE%\.. is the closest "environment variable" I could come up with. It might be possible, but highly unlikely that someone has moved it out c:\Users or c:\Documents and Settings. Thus, it would work both on XP and Vista with or without homefolder redirection.
But best of both worlds?
DEL /F /S /Q "%ALLUSERPROFILE%\..\foo.lnk"
As you said, this would delete any and all foo.lnk, not just those on the Desktop.