Link to home
Start Free TrialLog in
Avatar of Andy Brown
Andy BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Putting a shortcut onto the desktop (via a batch file)

Through a lot of help from the EE guys, I am now able to copy a shortcut onto the users desktop using the following syntax:

copy "C:\ProgramData\TS\TS.lnk "  "c:\users\%username%\desktop\TS.lnk"

I would ideally like to copy the shortcut TS.lnk onto EVERY users desktop - reliably.  Any ideas?
Avatar of Krzysztof Pytko
Krzysztof Pytko
Flag of Poland image

Hi, have you tried new Vista, Windows 7 feature ? Group Policy Prefernece should allow you creating short cut on user desktops. To be able using it on XP you need to install add-on (Client Side Extension) or install update over WSUS to your XP clients

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=e60b5c8f-d7dc-4b27-a261-247ce3f6c4f8&displaylang=en

Regards,
Krzysztof
Avatar of Andy Brown

ASKER

I am using a batch file (as part on an installation routine), that needs to run on XP, Vista and Win7.  So in a perfect world I'd be able to replace %username% with something like %allusers%
OK, what if you will use %ALLUSERSPROFILE% variable with \Desktop ?

Krzysztof
Try this:

if exist "C:\Users\Public\Desktop\"   copy \\someserver\someshare\ts.lnk "C:\Users\Public\Desktop\"
if exist "C:\documents and settings\all users\desktop\"   copy \\someserver\someshare\ts.lnk "C:\documents and settings\all users\desktop"
Brilliant.

Do you think the %ALLUSERSPROFILE% will be ok across XP, Vista and Win7?
ASKER CERTIFIED SOLUTION
Avatar of Krzysztof Pytko
Krzysztof Pytko
Flag of Poland 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
Thanks guys - very much appreciated.
You're welcome :)