Jump to content

Removing Desktop Icons with batch


Recommended Posts

Hey,

I cant figure out how to delete some icons from the desktop:

DEL /S /F /Q "%UserProfile%\Bureaublad\VLC media player.lnk"
DEL /S /F /Q "%UserProfile%\Bureaublad\QuickTime Player.lnk"
DEL /S /F /Q "%UserProfile%\Bureaublad\Malwarebytes' Anti-Malware.lnk"
DEL /S /F /Q "%UserProfile%\Bureaublad\Adobe Reader 9.lnk"
DEL /S /F /Q "%AllUsersProfile%\Bureaublad\Adobe Reader 9.lnk"
DEL /S /F /Q "%AllUsersProfile%\Bureaublad\Malwarebytes' Anti-Malware.lnk"
DEL /S /F /Q "%AllUsersProfile%\Bureaublad\QuickTime Player.lnk"
DEL /S /F /Q "%AllUsersProfile%\Bureaublad\VLC media player.lnk"
DEL /S /F /Q "%AllUsersProfile%\Desktop\Adobe Reader 9.lnk"
DEL /S /F /Q "%AllUsersProfile%\Desktop\Malwarebytes' Anti-Malware.lnk"
DEL /S /F /Q "%AllUsersProfile%\Desktop\QuickTime Player.lnk"
DEL /S /F /Q "%AllUsersProfile%\Desktop\VLC media player.lnk"
DEL /S /F /Q "%UserProfile%\Desktop\VLC media player.lnk"
DEL /S /F /Q "%UserProfile%\Desktop\QuickTime Player.lnk"
DEL /S /F /Q "%UserProfile%\Desktop\Malwarebytes' Anti-Malware.lnk"
DEL /S /F /Q "%UserProfile%\Desktop\Adobe Reader 9.lnk"

Thats what I tried, I also tried just DEL without switches, but it aint working.

I tried Desktop (ENU) and Bureaublad (NL), I am using NL Windows 7.

Maybee an other way, making addon that deletes them or.. ?

Edited by Raoul
Link to post
Share on other sites

looks like you might no be admin, try removing @echo off and putting a pause at the end to see what error is returned.also why not do:

cleanup.bat


DEL /F /Q "%UserProfile%\Bureaublad\*.lnk"
DEL /F /Q "%AllUsersProfile%\Bureaublad\*.lnk"
DEL /F /Q "%systemdrive%\Users\Public\Bureaublad\*.lnk"

note that i have removed the /s switch as you are giving it the full path thus dosent need to erase in any sub dir.Plus i added the 3rd line as its a new desktop path that is kinda like allusers/desktop.And remember ure batch file will ahve to be run as admin.

if ure running the batch as part of an automation then ull ahve to provide a user name which is an admin and call the "cleanup.bat" or what ever ure going to name it.

runpromoted.bat


runas /user:SOMEADMIN /savecred cleanup.bat

you will have to enter the name of the admin account of the pc here > SOMEADMIN

also the "/savecred" switch is optional, it keeps you from having to re-enter the account password a 2nd time if the batch is ran later.

if its being ran from a cd then ull have to change it like so:


SET CDROM=%~d0
runas /user:SOMEADMIN /savecred %CDROM%\cleanup.bat

Link to post
Share on other sites

I run it from FirstLogonCommand in Autounattended.xml.

But I dont want to remove all icons, just the ones I pointed out, so not the *.lnk.

Will try it with the PAuse, to find out the error.

ok, but i am prety sure its cause of admin privileges.

Link to post
Share on other sites
  • 2 weeks later...

Thanks but I dont want to delete all of the icons.

Just did this:

DEL /F /Q "%UserProfile%\Bureaublad\VLC media player.lnk"
DEL /F /Q "%UserProfile%\Bureaublad\QuickTime Player.lnk"
DEL /F /Q "%UserProfile%\Bureaublad\Malwarebytes' Anti-Malware.lnk"
DEL /F /Q "%UserProfile%\Bureaublad\Adobe Reader 9.lnk"
DEL /F /Q "%AllUsersProfile%\Bureaublad\Adobe Reader 9.lnk"
DEL /F /Q "%AllUsersProfile%\Bureaublad\Malwarebytes' Anti-Malware.lnk"
DEL /F /Q "%AllUsersProfile%\Bureaublad\QuickTime Player.lnk"
DEL /F /Q "%AllUsersProfile%\Bureaublad\VLC media player.lnk"
DEL /F /Q "%AllUsersProfile%\Desktop\Adobe Reader 9.lnk"
DEL /F /Q "%AllUsersProfile%\Desktop\Malwarebytes' Anti-Malware.lnk"
DEL /F /Q "%AllUsersProfile%\Desktop\QuickTime Player.lnk"
DEL /F /Q "%AllUsersProfile%\Desktop\VLC media player.lnk"
DEL /F /Q "%UserProfile%\Desktop\VLC media player.lnk"
DEL /F /Q "%UserProfile%\Desktop\QuickTime Player.lnk"
DEL /F /Q "%UserProfile%\Desktop\Malwarebytes' Anti-Malware.lnk"
DEL /F /Q "%UserProfile%\Desktop\Adobe Reader 9.lnk"
DEL /F /Q "%systemdrive%\Users\Public\Bureaublad\VLC media player.lnk"
DEL /F /Q "%systemdrive%\Users\Public\Bureaublad\QuickTime Player.lnk"
DEL /F /Q "%systemdrive%\Users\Public\Bureaublad\Malwarebytes' Anti-Malware.lnk"
DEL /F /Q "%systemdrive%\Users\Public\Bureaublad\Adobe Reader 9.lnk"
DEL /F /Q "%systemdrive%\Users\Public\Desktop\VLC media player.lnk"
DEL /F /Q "%systemdrive%\Users\Public\Desktop\QuickTime Player.lnk"
DEL /F /Q "%systemdrive%\Users\Public\Desktop\Malwarebytes' Anti-Malware.lnk"
DEL /F /Q "%systemdrive%\Users\Public\Desktop\Adobe Reader 9.lnk"

One of them did the job. :P

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...