Windows 8 and 8.1 Forums


XCOPY for SkyDrive backup

  1. #1


    Posts : 1,875
    Windows 10 Pro Prieview x64

    XCOPY for SkyDrive backup


    I'm trying to make a script to backup SkyDrive folder which I'll schedule in Task Scheduler. This is it..

    Code:
    @echo off
    if not exist E:\FileHistory\%username%\SkyDrive MD E:\FileHistory\%username%\SkyDrive  
    xcopy %userprofile%\SkyDrive\*.* E:\FileHistory\%username%\SkyDrive /c /d /e /g /h /i /k /o /q /r /v /x /y > E:\FileHistory\%username%\SkyDrive\xcopy.log
    This works fine but my E: drive is in a docking station so I want to check that the docking station is connected (that is the E: drive exists) before running it. Is that possible?

      My System SpecsSystem Spec

  2. #2


    N. Calif
    Posts : 2,584
    W10 Pro (desktop), W10 (laptop), W10 Pro (tablet), W10 (laptop)


    Pick a known file (or create a dummy file) on drive E: and test for it.

    Code:
    @echo off
    IF NOT EXIST E:\test.fil goto not_fnd
    if not exist E:\FileHistory\%username%\SkyDrive MD E:\FileHistory\%username%\SkyDrive  
    xcopy %userprofile%\SkyDrive\*.* E:\FileHistory\%username%\SkyDrive /c /d /e /g /h /i /k /o /q /r /v /x /y > E:\FileHistory\%username%\SkyDrive\xcopy.log
    goto :xit
    :not_fnd
    ECHO Drive E: not found
    :xit
      My System SpecsSystem Spec

  3. #3


    Posts : 1,875
    Windows 10 Pro Prieview x64


    Excellent, thanks. I've done this and scheduled it to run every hour and it works perfectly.

    Is there any way however to stop the empty black cmd.exe box flashing up for a split second every time it runs?
      My System SpecsSystem Spec

  4. #4


    N. Calif
    Posts : 2,584
    W10 Pro (desktop), W10 (laptop), W10 Pro (tablet), W10 (laptop)


    Here's a link to some discussion about that: Can I Run a Windows Batch File without a Visible Command Prompt?
      My System SpecsSystem Spec

  5. #5


    Posts : 1,875
    Windows 10 Pro Prieview x64


    Thanks. In the end I changed the code to this:

    Code:
    @echo off
    set backupdrive=E:
    set users=%SystemDrive%\Users
       
    if not exist %backupdrive%\FileHistory goto End
    for /d %%x in (%users%\*) do (
      call:FnCopy %%~nxx    
      )
      
    :FnCopy
      if not exist %users%\%1\SkyDrive\ goto :EOF
      if not exist %backupdrive%\FileHistory\%1\SkyDrive MD %backupdrive%\FileHistory\%1\SkyDrive 
      robocopy %users%\%1\SkyDrive %backupdrive%\FileHistory\%1\SkyDrive /b /e /r:0 /w:0 /copyall /mt /log:%backupdrive%\FileHistory\%1\SkyDriveLog.log         
      goto :EOF
      
    :End
    And scheduled the task to run under SYSTEM profile - no more pop-up and all users SkyDrive now backed up
      My System SpecsSystem Spec

XCOPY for SkyDrive backup
Related Threads
"C:\Users\username\AppData\Roaming\App Launcher Gadget" F:\Backup\Common\App_Launcher\AppLauncherSettings /i I want to copy "App Launcher Gadget" folder to "AppLauncherSettings" folder. I have tried several ways and only get the files copied or invalid directory.
Hi everyone, I recently upgraded from Windows 7 to Windows 8.1 OS on my HP Pavilion p6330f desktop PC. Prior to installing the new Windows 8.1 tower, I copied and saved to DVD+R disks my documents, pictures, videos, etc. from Windows 7 OS. Then I tried to install them into my new Windows 8.1 OS...
xcopy cannot find directory path in Performance & Maintenance
Greetings all! New here - hope you are all having an exciting summer! I'm trying to change the default location of my User folder to another drive. I had this same setup function before I upgraded my SSD. Now with a fresh SSD and a fresh install of windows, I'm having trouble copying the User...
Why doesn't File History backup Skydrive in Performance & Maintenance
I really like the way Skydrive synchronises my folders between my work and home laptops and I have my Skydrive docs available offline. But why is Skydrive excluded from the list of libraries that are backed up by File History. I want to be able to back my docs up onto an external hard drive. Is...
Solved SkyDrive in Network & Sharing
Hello I have a photo in SkyDrive that appears when I click on shared, to the left. It is the same as the photo I see when I sign in to my pc. Is it in SkyDrive because it is shared with my sign in? I wish not to have anything in SkyDrive but when I click on the file and click to remove it,...
I know SkyDrive is explicitly excluded from File History backup in 8.1 but does anyone have an idea of how I could get the same functionality? I'm using File History to make ad-hoc system images from C:\ to E:\ and also various libraries. As SkyDrive doesn't get backed up even if in a library...
Help with Skydrive in Network & Sharing
Hi, I was wondering how to map skydrive as a network drive in windows 8. I looked on the internet and found results for windows 7 - I don't know if these will work in windows 8. Please help! Al
Eight Forums Android App Eight Forums IOS App Follow us on Facebook