Link to home
Start Free TrialLog in
Avatar of m0nk3yza
m0nk3yzaFlag for South Africa

asked on

Deleting desktop shotcuts after login script ran

Hi Guys,

I use Win XP Pro (SP 2).

When I log into my company's domain, the login script places approx. 15 shortcut icons on my desktop (which includes shortcuts to MS office, several network resources and even Windows Media player).

I never us any of these and it just clutters up my desktop.

The sysadmins can't remove this from the login script, as some employees use them.

Is it possible to place a script in the Start up Folder, which will run after the login script has executed, which will delete the icons from my desktop?

What would this "clean-up" script contain?

Thank you.

jo
Avatar of Frosty555
Frosty555
Flag of Canada image

You could make a .BAT file that deletes the shortcuts. The code would be something like:

@echo off
del "%userprofile%\desktop\Microsoft Office Word 2003.lnk"
del "%userprofile%\desktop\Some other icon.lnk"
del "%userprofile%\desktop\Some network resource.lnk"

And drop that into your startup folder. You'd need to make sure this got executed AFTER the logon script from your domain got executed (otherwise the icons wouldn't have arrived yet!). If it's always getting executed first... you can just put the file on your desktop and doubleclick it when your system has loaded.

Shortcuts on your desktop are just ".lnk" files, where the name of the file is the caption on the icon

write in Notepad the snippet and save it as .BAT or .CMD file.
Copy it onto your Start Up menu and that is all done.
@echo off
DEL /F "%USERPROFILE%\Desktop\office*.lnk"
DEL /F "%USERPROFILE%\Desktop\any other file.txt"

Open in new window

It should be possible to do so, or atleast you could put a registry string in your registry database, to startup with windows.

You should make a .bat script, with something like this:

Delete c:\documents and settings\[Your account]\Desktop\[filename]

Then put in one line for each file.

Then go to start > run, and type regedit, and go to the following:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Make a new key with the type "REG_SZ" and value should be the path to the .bat file you just made.

Hope that can help you, and will work for you.
Avatar of m0nk3yza

ASKER

Hi Guys,

Thanks for the response.

The login script seems to be executed after this .BAT file.

So the shortcuts are deleted, then recreated by the login script.

Any ideas on how to delay the execution on the .BAT file?

Thank you.

jo
SOLUTION
Avatar of Frosty555
Frosty555
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial