Solved

Why does the shortcut break

Posted on 2004-09-08
1
295 Views
Last Modified: 2012-08-13
I have a batch file that maps 2 network drives, 4 printers and then creates a shortcut on the desktop.

The problem I'm having is:
Whenever a user logs on the script adds a duplicate shortcut (so there are two shortcuts to the program) both shortcuts will pull the program up but the user will get an error message.  To fix this problem, I have to go to the computer delete both shortcuts and remake the shortcut manually.  The program is on the mapped drive "M"

Here is a copy of the script I'm running:

net use f: \\server\apps
net use M: \\server\metro
shortcut.exe /a:c /f:"%USERPROFILE\Desktop\MetroScan.lnk" /t:f:\METRO\WINDOWS\WINMETRO.EXE
rundll32 printui.dll,PrintUIEntry /u /in /n \\ELDORADO-BDC\Kyocera3800
rundll32 printui.dll,PrintUIEntry /u /in /n \\ELDORADO-BDC\Ricoh Copier
rundll32 printui.dll,PrintUIEntry /u /in /n \\SERVER\Kyocera9100
rundll32 printui.dll,PrintUIEntry /u /y /in /n \\SERVER\Suite200


thanks
0
Comment
Question by:Sglennlmb
1 Comment
 
LVL 5

Accepted Solution

by:
jmacmicking earned 125 total points
ID: 12009301
How about just IF EXIST in the batch file to check to see if the link exists before creating it? For instance:

net use f: \\server\apps
net use M: \\server\metro
IF EXIST "%USERPROFILE\Desktop\MetroScan.lnk" GOTO AssignPrinters

shortcut.exe /a:c /f:"%USERPROFILE\Desktop\MetroScan.lnk" /t:f:\METRO\WINDOWS\WINMETRO.EXE

:AssignPrinters
rundll32 printui.dll,PrintUIEntry /u /in /n \\ELDORADO-BDC\Kyocera3800
rundll32 printui.dll,PrintUIEntry /u /in /n \\ELDORADO-BDC\Ricoh Copier
rundll32 printui.dll,PrintUIEntry /u /in /n \\SERVER\Kyocera9100
rundll32 printui.dll,PrintUIEntry /u /y /in /n \\SERVER\Suite200
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
This article will show, step by step, how to integrate R code into a R Sweave document
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now