Solved

Why does the shortcut break

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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 …

744 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