Computing.Net > Forums > Programming > Batch file ?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file ?

Reply to Message Icon

Name: mattd75
Date: April 7, 2008 at 07:12:11 Pacific
OS: xp pro
CPU/Ram: 2gb
Product: dell/optiplex
Comment:

Does anyone have a batch file that will remove desktop icons?

Thanks in advance!



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: April 9, 2008 at 08:16:57 Pacific
Reply:

Just a one-liner:

del /p "%USERPROFILE%\Desktop"


0

Response Number 2
Name: Synetech
Date: April 9, 2008 at 08:59:27 Pacific
Reply:

He asked to remove icons, not files, but he may have meant both.

It really depends on what you are trying to do.

klint's suggestion of just deleting all the files is the (forceful) way to go if you want to remove (delete) files.

There is no easy way to remove icons. The standard ones have known CLSIDs which can be used (with some registry editing) to remove them, but any non-standard ones cannot be removed without first determining it's CLSID.

If you simply want to clear the desktop, there is a hide-icons-on-desktop command when you right-click on the desktop. Like the previous option, you can create a REG file that contains the relevant changes and use a command to merge that into the registry to do that.

--
Alec S.


0

Response Number 3
Name: klint
Date: April 9, 2008 at 11:03:52 Pacific
Reply:

Synetech: "He asked to remove icons, not files"

When you place a file on the desktop, it shows as an icon. So, to delete icons, you need to delete files.

"just deleting all the files is the (forceful) way to go"

How is it forceful? The /P parameter stands for "prompt." It will not delete anything if you don't ask it to.

"There is no easy way to remove icons. The standard ones have known CLSIDs"

Oh, now I see what you meant. These icons are things like the "My Computer" and "Recycle Bin" icon. So, you're right, they're not easy to delete in a batch file.

It all depends on what Matt meant by an icon. If it's the built-in ones represented by the CLSIDs, then yes it's difficult. If it's user-placed icons (including those created by installing software) then these are just files, which can be removed by the DEL command.

However, some icons are not on the current user's desktop, but in the All Users desktop.


0

Response Number 4
Name: mattd75
Date: April 14, 2008 at 14:14:46 Pacific
Reply:

Thanks for the help guys! I ended up finding this

C:
del /q "%AllUsersProfile%\Desktop\Edulog Web Fieldtrip.url"

and just changed the name and .url to .lnk depending on the type.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch file ?

Batch file to count a specific character in a www.computing.net/answers/programming/batch-file-to-count-a-specific-character-in-a/19751.html

FTP batch file www.computing.net/answers/programming/ftp-batch-file/9027.html

batch file www.computing.net/answers/programming/batch-file/13936.html