Deleting desktop icons using batch?
I'm trying to create a batch that will delete an icon from the desktop however its not working could anyone elaborate on this?
del "%userprofile%\Bureaublad\AutoCAD 2006.i开发者_如何学JAVAco"
Second part of my question, the %userprofile% works fine at work however is this valid with home pc's?
maybe Your script waits the confirmation of deleting file?
try:
echo y | del "%userprofile%\Bureaublad\AutoCAD 2006.ico"
your code should be working wonderfully...do you maybe mean a program link? Then the extension would have to be .lnk ?
so it would be:
del "%userprofile%\Bureaublad\AutoCAD 2006.lnk"
Should work with any windows Pc - only problem could be UAC with Vista and upwards.
Well, %userprofile% will get you to the User directory, not the Desktop directory. Try writing something like
del "%userprofile%\Desktop\MyIcon.ico"
Btw, if you by "icon" actually mean the shortcut for the application in question the extension would not be .ico but .lnk
And yes, %userprofile% should work on your home PC as well.
PS: All of the above is assuming that you are using Windows.
精彩评论