MAVERICKS CHOICE Posted June 30, 2005 Posted June 30, 2005 (edited) Goin through my cleanup.cmd & cannot get both Nero 66014 & Mozilla Firefox 1.04 Desktop shortcuts to go away..delete?Heres the code relevant to the .cmdECHO.ECHO Please wait...Echo Removing Nero startsmart desktop Icon....Please WaitDEL /S /Q "%userprofile%\desktop\*Nero*.lnk"ECHO.ECHO Please wait...Echo Removing Mozilla Firefox desktop Icon....Please WaitDEL /S /Q "%userprofile%\desktop\*Mozilla Firefox*.lnk"The .cmd however works but not UA, & before I'm flamed yes I have read quite many pages & searched? I have already manged to solve other shortcut problems but not these two? I have only my administrator acc no others.Any light guys? Edited June 30, 2005 by MAVERICKS CHOICE
Yzöwl Posted June 30, 2005 Posted June 30, 2005 (edited) I have posted this one before, it may not be what you want, but this one run as cleanup.cmd will get rid of all the desktop shortcuts@echo off&setlocal enableextensionsfor /d %%a in ("%AllUsersProfile:\All Users=%\*") do if exist "%%~a\Desktop\*" del /q "%%~a\Desktop\*.lnk"endlocal&goto :eofIt should be on three lines only! Edited June 30, 2005 by Yzöwl
MAVERICKS CHOICE Posted June 30, 2005 Author Posted June 30, 2005 (edited) I have posted this one before, it may not be what you want, but this one run as cleanup.cmd will get rid of all the desktop shortcuts@echo off&setlocal enableextensionsfor /d %%a in ("%AllUsersProfile:\All Users=%\*") do if exist "%%~a\Desktop\*" del /q "%%~a\Desktop\*.lnk"endlocal&goto :eofIt should be on three lines only!<{POST_SNAPBACK}>Yeah Thanks Yzowl nice code,but there are some links I wanna keep & my cleanup.cmd needs to be such & run last in Ua. Edited June 30, 2005 by MAVERICKS CHOICE
Gouki Posted June 30, 2005 Posted June 30, 2005 I delete them from %allusersprofile% and %userprofile%. Have u tried that?del /S /Q "%UserProfile%\..."del /S /Q "%AllUsersProfile%\..."
MAVERICKS CHOICE Posted June 30, 2005 Author Posted June 30, 2005 No I haven't but only running a single admin user acc, no others?
vcBlackBox Posted June 30, 2005 Posted June 30, 2005 They are not in %userprofile% but %AllUsersProfile%And your syntax is incorrect. Should be Nero*.lnk and Mozilla Firefox*.lnk instead.And why don't you use the actual name for the shortcuts?I don't believe they change names from version to versions.
Astalavista Posted June 30, 2005 Posted June 30, 2005 (edited) //Nero DEL "%UserProfile%\Application Data\Microsoft\Internet Explorer\Quick Launch\Nero StartSmart.lnk"DEL "%AllUsersProfile%\Desktop\Nero StartSmart.lnk"tested and workingrun this cleanup command after u install nero.if your running wpi run it at the every end with cleanup.cmd Edited June 30, 2005 by Astalavista
MAVERICKS CHOICE Posted June 30, 2005 Author Posted June 30, 2005 They are not in %userprofile% but %AllUsersProfile%And your syntax is incorrect. Should be Nero*.lnk and Mozilla Firefox*.lnk instead.And why don't you use the actual name for the shortcuts?I don't believe they change names from version to versions.<{POST_SNAPBACK}>OK I will tho the *Nero* does delete all chars before & after "Nero" is just simpler.
MAVERICKS CHOICE Posted June 30, 2005 Author Posted June 30, 2005 (edited) //Nero DEL "%UserProfile%\Application Data\Microsoft\Internet Explorer\Quick Launch\Nero StartSmart.lnk"DEL "%AllUsersProfile%\Desktop\Nero StartSmart.lnk"tested and workingrun this cleanup command after u install nero.if your running wpi run it at the every end with cleanup.cmd<{POST_SNAPBACK}>Thanks Asta taken on board but not sure this is gonna work Ua? Going to retest however.Edit: Not working live in windows my code above is, but not Ua?EDIT2: Whats got me is I use the same code for Spybot14 & works great & Astas similar code for the Quicklaunch? Edited June 30, 2005 by MAVERICKS CHOICE
Vadikan Posted June 30, 2005 Posted June 30, 2005 YzöwlCould you please explain how this part in ("%AllUsersProfile:\All Users=%\*")works?
Yzöwl Posted June 30, 2005 Posted June 30, 2005 (edited) Replacing characters in a variable, copy and paste the following into your text editor, save as xample.cmd and double click it@echo off&setlocal enableextensionsset MyVar=Some Stringecho Your variable is %MyVar%set NewVar=%MyVar: =_%echo Your variable is now %NewVar%set OneMore=%NewVar:S=%echo Your variable this time is %OneMore%pause&endlocal&goto :eofNow look at the output on the screenSo looking at the code you quoted, what I am doing is%AllUsersProfile%\* » C:\Documents and Settings\All Users\*therefore%AllUsersProfile:\All Users=%\* » C:\Documents and Settings\*I have replaced the string 'after the colon and before the equals' "\All Users" with the string 'after the equals' "", in effect removing \All Users from the variable. Edited June 30, 2005 by Yzöwl
Vadikan Posted June 30, 2005 Posted June 30, 2005 Thanks for your reply, Yzöwl. Very good explanation, I got it. Pretty cool P.S. There should be an ampersand instead of the underscore in the last line.
Yzöwl Posted June 30, 2005 Posted June 30, 2005 fixed VAD thanks, next time I'll read it in preview mode first!
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now