Windows Vista Thread, Using Robocopy in Technical; Hi
I am trying to write an install file to overight some files on the hard drive using either a ...
30th October 2009, 04:28 PM #1
- Rep Power
I am trying to write an install file to overight some files on the hard drive using either a CD or Memeory stick into multiple directories.
I managed it fine on XP machines using the following
xcopy *.*/e/y c:\"program files"\luk\lukinfo
This however does not work with Vista.
I figured out that the "program files" doesnt work so tried the short dos version
I have tried....
robocopy d:\ c:\progra~1\luk\lukinfo
robocopy d:\/e c:\progra~1\luk\lukinfo
robocopy d:\ c:\progra~1\luk\lukinfo/e
and lots of other variations
Whilst it copies the files from the root directory of my stick (D it does not copy the files in the subdirectories regardless of where I put the /e switch ???
I will put the /y switch back in when I am happy it works OK.
I think I will also have a problem if winders allocates a different drive letter to the memory stick or CD.
Can anyone help ?
30th October 2009, 04:30 PM #2
Try putting the quotes around the whole path, not just the Program Files bit. e.g "c:\program files\luk\lukinfo"
And put a space before the /e
30th October 2009, 05:06 PM #3
- Rep Power
Thanks for the support.
I tried ...
robocopy d:\ /e "c:\progra~1\luk\lukinfo"
robocopy d:\ "c:\progra~1\luk\lukinfo /e"
robocopy d:\ "c:\program files\luk\lukinfo" /e
robocopy d:\ "c:\program files\luk\lukinfo /e"
Xcopy *.*/e "c:\program files\luk\lukinfo"
and all of them stop at the install.bat file which I am using to overight the files saying access denied ?
I am in administration account.
Tried doing in a cmd window with the same result ?
any more ideas ?
30th October 2009, 05:13 PM #4
robcopy needs /s to copy subdirectories (/e copies empty sub-directories)
30th October 2009, 05:56 PM #5
- Rep Power
robocopy D:\ c:\progra~1\luk\lukinfo /s
However ... how can i get round the issue of winders allocating the memory stick a different drive letter on another machine i.e. if it calls if F: robocop D:\ wont work ???
30th October 2009, 07:41 PM #6
This vbscript might help. Basically, it looks at each removable device and checks the label. When it finds "MYUSB" it knows the drive letter and runs robocopy from specific folders on the C: drive to the backup device - in the example it backs up c:\work\photos to a folder called pictures on the device and c:\music to a folder called music on the device.
The /mir means mirror - it deletes from the device if it's been deleted from the source - if you don't want that then change it to /s /e
The /w:1 and /r:1 mean wait 1 second if there's a problem and retry once; by default robocopy wil retry from now until the Christmas after next - if there's a temporary glitch, 1 retry is enough!
Finally, /fft says use FAT file times - NTFS is more precise than FAT in file times and I had problems with files copying because somehow robocopy thought they were different even though they were the same; you may not need it.
Set Service = Locator.ConnectServer(".")
Set items=service.execquery("Select * from Win32_LogicalDisk where drivetype=2") 'dt 2 is removable
For Each item In items
if ucase(item.volumename)="MYUSB" then sLetter=item.name
if sLetter="N/A" then
wscript.echo "Can't find memory stick; ending"
sCmd="robocopy c:\" & sSrc & " " & sLetter & "\" & sDest & " /fft /mir /w:1 /r:1" 'fat file time
30th October 2009, 10:40 PM #7
Don't you need elevated privileges in Windows Vista and 7 to write files to %ProgramFiles% or %SystemRoot%? Isn't that why MGTechman is getting Access Denied errors (even as Administrator)?
Another way to search for the drive letter of the USB flash drive would be to do something like the following. As long as you have a file that is unique on the flash drive, the batch file will be able to find the drive letter of it. The file can be anything you want - even an empty text file.
FOR %%i IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\SomethingUnique.txt SET FlashDrive=%%i:\
RoboCopy %FlashDrive% c:\progra~1\luk\lukinfo /s
6th November 2009, 12:21 AM #8
why search for the drive letter?
it looks like you want to do this on multiple machines, so why not have a batch file with that command in it, and the robocopy file sat on the stick right next to all the files to be copied.
your command would then be:
%~dp0/robocopy.exe %~dp0/lukinfo c:\progra~1\luk\lukinfo /s
%~dp0 is windows cmd for present working directory (PWD)
Last edited by box_l; 6th November 2009 at 03:02 PM.
6th November 2009, 05:43 PM #9
- Rep Power
Thats exactly what I am trying to do and the %~dp0 looks like the missing link !
Didnt find that on any "how to use Robocopy" sites.
Will try it the weekend
By Nemernic in forum Scripts
Last Post: 28th July 2009, 12:23 PM
By speckytecky in forum Windows
Last Post: 29th July 2008, 10:29 AM
Last Post: 11th July 2008, 12:06 PM
By soze in forum How do you do....it?
Last Post: 2nd June 2008, 03:42 PM
By acrobson in forum How do you do....it?
Last Post: 22nd December 2007, 02:41 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)