Solved

Why does the shortcut break

Posted on 2004-09-08
1
298 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

809 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