SuperSnooper
asked on
Batch File command to Copy a Shortcut from a CD to the Desktop
I have a batch file on a CD that copies an Access Database (type mde) from the CD to a folder on the hard drive. The Batch then copies a shotrcut from the CD to the desktop. The command that I am using is as follows:
Copy "Shortcut to Work_Order_DataBase.mde.ln k" "C:\Documents and Settings\All Users\Desktop\*.*"
I can click on the CD Shortcut and it will open the database in the C drive folder, but the command will not copy the shortcut to the desktop.
Copy "Shortcut to Work_Order_DataBase.mde.ln
I can click on the CD Shortcut and it will open the database in the C drive folder, but the command will not copy the shortcut to the desktop.
Actually, try Copy "Work_Order_DataBase.mde.l nk" "%allusersprofile%\Desktop \*.*" /y
"Shortcut to" is not part of the DOS file name.
"Shortcut to" is not part of the DOS file name.
ASKER
Guys...Bad News!
Neither of the comments worked. I copied and pasted so the coding is as submitted. The coding isn't finding the Shortcuts on the CD. The error code says "The system cannot find the file specified".
David
Neither of the comments worked. I copied and pasted so the coding is as submitted. The coding isn't finding the Shortcuts on the CD. The error code says "The system cannot find the file specified".
David
Are you sure the shortcut is ON the CD?
If you do a "dir" on the CD, what are the files returned?
If you do a "dir" on the CD, what are the files returned?
ASKER
The Shortcuts are on the CD. I tested the shortcuts out to make sure that they would open the databases on the hard drive...They did.
In the past, I referenced the CD (D:\.......) and the files would copy. After thinking about it, I realized that all computers don't have "D" as their CD drive. So I am trying to eleminate that problem.
PS: I also got the same error message for the "If" statement.
David
In the past, I referenced the CD (D:\.......) and the files would copy. After thinking about it, I realized that all computers don't have "D" as their CD drive. So I am trying to eleminate that problem.
PS: I also got the same error message for the "If" statement.
David
Please post the results of the DIR - I'm sure we can come up with a solution if we're not blind trying to..
ASKER
Leew,
Here is the coding:
Copy "Work_Order_DataBase.mde" "C:\UMDR\DataBase\*.*"
Copy "Map_DataBase.mde" "C:\UMDR\DataBase\*.*"
Copy "TEST_DATA_Work_Order_Data Base.mde" "C:\UMDR\DataBase\*.*"
Copy "TEST_Map_DataBase.mde" "C:\UMDR\DataBase\*.*"
Copy "Work_Order_DataBase.mde.l nk" "%allusersprofile%\Desktop \*.*" /y
Copy "TEST_DATA_Work_Order_Data Base.mde.l nk" "%allusersprofile%\Desktop \*.*" /y
IF exist "%allusersprofile%\Desktop \Work_Orde r_DataBase .mde.lnk" attrib -r "%allusersprofile%\Desktop \Work_Orde r_DataBase .mde.lnk"
Copy "Work_Order_DataBase.mde.l nk" "%allusersprofile%\Desktop \*.*" /y
rem Copy "Shortcut to Work_Order_DataBase.mde.ln k" "%allusersprofile%\Desktop \*.*" /y
IF exist "%allusersprofile%\Desktop \TEST_DATA _Work_Orde r_DataBase .mde.lnk" attrib -r "%allusersprofile%\Desktop \TEST_DATA _Work_Orde r_DataBase .mde.lnk"
Copy "TEST_DATA_Work_Order_Data Base.mde.l nk" "%allusersprofile%\Desktop \*.*" /y
rem Copy "Shortcut to TEST_DATA_Work_Order_DataB ase.mde.ln k" "%allusersprofile%\Desktop \*.*" /y
As you cansee there isfour copiesbefore the shortcut copies. The first four copied the shortcuts and the"ifs" erroredout.
I can send you a screen print of the batch results if youwish. I willrequire ane-mailaddress to accomplish that. The results are type ".jpg".
Thanks
David
Here is the coding:
Copy "Work_Order_DataBase.mde" "C:\UMDR\DataBase\*.*"
Copy "Map_DataBase.mde" "C:\UMDR\DataBase\*.*"
Copy "TEST_DATA_Work_Order_Data
Copy "TEST_Map_DataBase.mde" "C:\UMDR\DataBase\*.*"
Copy "Work_Order_DataBase.mde.l
Copy "TEST_DATA_Work_Order_Data
IF exist "%allusersprofile%\Desktop
Copy "Work_Order_DataBase.mde.l
rem Copy "Shortcut to Work_Order_DataBase.mde.ln
IF exist "%allusersprofile%\Desktop
Copy "TEST_DATA_Work_Order_Data
rem Copy "Shortcut to TEST_DATA_Work_Order_DataB
As you cansee there isfour copiesbefore the shortcut copies. The first four copied the shortcuts and the"ifs" erroredout.
I can send you a screen print of the batch results if youwish. I willrequire ane-mailaddress to accomplish that. The results are type ".jpg".
Thanks
David
Hey.
Try using the COPY Command with the /V switch
Try using the COPY Command with the /V switch
ASKER
Here2Help,
Can you post where the /V switch should be.
David
Can you post where the /V switch should be.
David
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Here2Help,
I found another error. The ".mde" was not a part of the shortcut name. It was just the extention for the shortcut target. With this change, I can copy the shortcut from the CD to another folder.
Now...there is still one error. The "%allusersprofile%\Desktop \....." is not the correct syntax. Any ideas?
David
I found another error. The ".mde" was not a part of the shortcut name. It was just the extention for the shortcut target. With this change, I can copy the shortcut from the CD to another folder.
Now...there is still one error. The "%allusersprofile%\Desktop
David
ASKER
Here2Help,
Thanks Guy. I finally realized that the "%allusersprofile%" had not been defined. Am I not a dummy! Anyway, it works like a charm.
David
Thanks Guy. I finally realized that the "%allusersprofile%" had not been defined. Am I not a dummy! Anyway, it works like a charm.
David
Try adding a line like this before the copy:
IF exist "%allusersprofile%\Desktop
Then modify your copy line to read:
Copy "Shortcut to Work_Order_DataBase.mde.ln