Michael Vasilevsky
asked on
Copy Shortcut with Batch File
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\D ataBaseNam e.lnk" "C:\Documents And Settings\%username%\deskto p\ 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
copy "\\ServerName\FolderName\D
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
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?
you need to place a copy of the .lnk at the specified folder
did you create a shortcut to your .mde? this is how your shortcut Target should look like.
"C:\Program Files\Microsoft Office\Office10\MSACCESS.E XE" "C:\Documents and Settings\%username%\LocalF older\Data base.mde"
"C:\Program Files\Microsoft Office\Office10\MSACCESS.E
ASKER
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!
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE
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!
Out of interest, if you manually execute that command from a DOS window, does it work?
ASKER
shanesuebsahakarn: no, same error : (
Are you able to move a shortcut with DOS okay?
Are you able to move a shortcut with DOS okay?
I am yes, on WinXP. I haven't tested with a UNC path though. It does require the lnk extension though.
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Aha, that worked.
Thanks shanesuebsahakarn.
Thanks shanesuebsahakarn.