?
Solved

Copy Shortcut with Batch File

Posted on 2005-03-01
10
Medium Priority
?
439 Views
Last Modified: 2008-02-01
I'm trying to write a batch file that will move the front-end of my db to a user's local machine and place a shortcut on the desktop.  I'm able to move the front-end okay but am having trouble creating a shortcut (which specifies .mdw). I'm unable to copy a shortcut file.  The code:

copy "\\ServerName\FolderName\DataBaseName.lnk" "C:\Documents And Settings\%username%\desktop\ DataBaseName.lnk"

gives me the error: "The system cannot find the file specified."

I am able to copy other files to/from the specified folders without problem, so it has something to do with the shortcut file type.

Is there a way to create a shortcut with MS DOS commands?
Any help would be appreciated.
Thanks,

mv
0
Comment
Question by:Michael Vasilevsky
[X]
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
  • 4
  • 4
  • 2
10 Comments
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 13435382
You appear to have a rogue space just before the DataBaseName.lnk in the second part of the copy statement. Could that be the problem?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 13435390
you need to place a copy of the .lnk at the specified folder
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 13435445
did you create a shortcut to your .mde?  this is how your shortcut Target should look like.

"C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE" "C:\Documents and Settings\%username%\LocalFolder\Database.mde"
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 10

Author Comment

by:Michael Vasilevsky
ID: 13440380
capricorn1: I'm not using an .mde, just .mdb with user-level security, therefore my shortcut path needs to look like:

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"  "C:\localfolder\DB_fe.mdb" /wrkgrp "\\Server\folder\db.MDW"

but my real problem is that I can't get MS DOS to copy any shortcut file with the syntax above.

Interestingly when I create the shortcut it does not have a .lnk extension.  If I add .lnk or any extension it's still a shortcut file and still won't copy.  (I do see file extensions for all other files in the same folder)

help!
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 13440507
Out of interest, if you manually execute that command from a DOS window, does it work?
0
 
LVL 10

Author Comment

by:Michael Vasilevsky
ID: 13440551
shanesuebsahakarn: no, same error : (

Are you able to move a shortcut with DOS okay?
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 13440588
I am yes, on WinXP. I haven't tested with a UNC path though. It does require the lnk extension though.
0
 
LVL 10

Author Comment

by:Michael Vasilevsky
ID: 13440747
okay, I have a .mdb file in C:\test\test.mdb.  I right-click, select Create Shortcut, and it creates a shortcut called "test".  Now I change the file name to "test.lnk"?  Either way:

copy "C:\test\test.lnk" "C:\test.lnk"

fails with the message "The System cannot find the file specified."  

copy "C:\test\test.mdb" "C:\test.mdb"

works fine.
 
This is on Win 2000 or XP.
0
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 1000 total points
ID: 13440820
Don't change the filename to test.lnk. By default, it is already called test.lnk, you just can't see the lnk extension (Windows will hide this regardless of your Show Extension settings).
0
 
LVL 10

Author Comment

by:Michael Vasilevsky
ID: 13440869
Aha, that worked.  
Thanks shanesuebsahakarn.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

771 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