Options
Script to copy a file from a mapped drive
Im trying to copy a file from a mapped drive. Id like to add thos to our current login script but im having trouble coming up with a script that works.
I have tried using both the Copy and Xcopy commands but it keeps telling me that I have a invalid number of parameters.
I have a feeling that this is happening because I cant access the mapped drive via the command prompt.
Does anybody have any idea how I could make this work?
I have tried using both the Copy and Xcopy commands but it keeps telling me that I have a invalid number of parameters.
I have a feeling that this is happening because I cant access the mapped drive via the command prompt.
Does anybody have any idea how I could make this work?
Comments
-
OptionsRobertKaucher Member Posts: 4,299 ■■■■■■■■■■Unless I am mistaken, mapped drives are mapped at login. This probably means that you are not able to access the drive yet. Try copying from the location using [URL="file://\\server\share\file.exe"]\\server\share\file.exe[/URL]
-
Optionsqwertyiop Member Posts: 725 ■■■□□□□□□□Well this is what I have so far:s:
cd MHD Standards\2009 Survey Standards\MHD (C3D) Survey Baseplan Files\MHD (C3D)\Templates
xcopy MHDBP(C3D).dwt %appdata%\autodesk\c3d 2009\enu\Template /s /e -
Optionskalebksp Member Posts: 1,033 ■■■■■□□□□□Try putting quotes around the second path in the xcopy command:
s: cd MHD Standards\2009 Survey Standards\MHD (C3D) Survey Baseplan Files\MHD (C3D)\Templates xcopy MHDBP(C3D).dwt "%appdata%\autodesk\c3d 2009\enu\Template" /s /e
-
Optionsrsutton Member Posts: 1,029 ■■■■■□□□□□I just ran xcopy /? and noticed this about the switches you are using:
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones.
It would seem having them both in place as you do would be contradictory. Also, you may need to use upper case letters - I don't recall if it's case sensitive. -
Optionsqwertyiop Member Posts: 725 ■■■□□□□□□□Try putting quotes around the second path in the xcopy command:
s: cd MHD Standards\2009 Survey Standards\MHD (C3D) Survey Baseplan Files\MHD (C3D)\Templates xcopy MHDBP(C3D).dwt "%appdata%\autodesk\c3d 2009\enu\Template" /s /e
Thanks for the help, im surprised that none of the examples that I found had the quotes -
OptionsRobertKaucher Member Posts: 4,299 ■■■■■■■■■■The reason is because of the space between c3d and 2009.
-
Optionsqwertyiop Member Posts: 725 ■■■□□□□□□□DO you happen to know if theres a switch that will tell it to overight a file if it already exists?
-
OptionsHyper-Me Banned Posts: 2,059And as an side, if you are trying to copy a file as the system with a script you have to give the computer object read permissions to the share where the file is located and then copy from the unc path such as \\server\share\file.exe , as Robert pointed out.
-
OptionsFugazi1000 Member Posts: 145You might also like to consider ROBOCOPY.EXE. More options than other copy methods and more robust in the event of disconnects etc.
-
Optionsqwertyiop Member Posts: 725 ■■■□□□□□□□I was able to get the my 1st of my script working but I have to review my 2nd script because it is failing on the xcopy portion.
-
Optionsbrad- Member Posts: 1,218Synctoy lets you synchronize, echo, or contribute to folder pairs. You can thrown a switch on to the end of the shortcut and set it as a scheduled task...works similarly as a batch copy command...but with more options.
as fair as y our standard batch script goes...i did something like that a while back and it had problems with the multiple worded folder names, so I had to truncate the folder name with ~1 to make that work. -
Optionstiersten Member Posts: 4,505Thanks for the help, im surprised that none of the examples that I found had the quotes