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

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 86

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
A simple method to resolve a "keyboard not working" problem by modifying the Windows registry. This issue can often be encountered after using the VMware vCenter Converter Standalone Agent to perform a Physical-to-Virtual (P2V) conversion process.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

616 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