Script problem

Posted on 2003-03-24
Medium Priority
Last Modified: 2010-04-13
This script should dump a Shortcut on the desktop of any user who activates it, but it does not.  The NET USE map was the only way I could see around the limitation of DOS to deal with UNCs.  Willing to try something else:

REM Makes a shortcut on a Users Desktop

net use E: \\matrix\shortcut\
copy E:\Mercury.lnk "C:\Documents and Settings\%USERNAME%\Desktop"
net use E: /delete /y
Question by:ellem52
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8197043
Change your target folder to C:\documents and settings\all users\desktop).  

Author Comment

ID: 8197282
Doesn't do it for some reason.  The problem seems to be with the UNC... grrr.

Author Comment

ID: 8197700

It is the trailing \ on the second line.
LVL 28

Expert Comment

ID: 8197703
Is shortcut the name of the share?

I've tested and this works on my computer:

rem syntax is: net use E: \\server_name\share_name

net use E: \\matrix\shortcut
copy E:\mercury.lnk "c:\documents and settings\%username%\desktop"
net use E: /delete
LVL 85

Accepted Solution

oBdA earned 200 total points
ID: 8204976
Hi ellem52,

some comments:
* Don't use "C:\Documents ..." as target directory; what you're looking for is "%UserProfile%\desktop".
* W2k's (and NT4's) command shell (which is actually not a DOS window) supports UNC paths for copying; so 'copy \\matrix\shortcut\mercury.lnk %UserProfile%\Desktop' should work.
* Take care when copying shortcuts: shortcuts contain the UNC path to the original target and will start it from there if copied to another machine (even if the target is installed on the other machine as well). You can change this behaviour with a group policy; look for "shell shortcuts" in "Administrative Templates\Windows Components\Windows Explorer" and in "Administrative Templates\Start Menu and Task Bar".

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
New style of hardware planning for Microsoft Exchange server.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question