Results 1 to 19 of 19

Thread: batch files

  1. #1
    Junior Member
    Join Date
    Jul 2006
    Posts
    8

    Talking batch files

    How do I make a batch file to run weekly that copies the source directory (which is the 'c' drive in my case) to the backup directory (the 'd' drive in my case) in windows? Thanks alot.

  2. #2
    Assistant Admin Ken's Avatar
    Join Date
    Dec 1969
    Location
    Tampa
    Posts
    12,043
    This is a simplified version of a batch file that I use. You can place on your desktop and just click it whenever you want it to do it's thing...

    This one will copy your profiles completely which would include things like your favorites, email, my docs, etc., to your D drive...

    Just open notepad and paste the info below, then save it as xxxxx.bat (The xxx can be whatever you want, example "denisfiles.bat" )


    Code:
    set drive=d:\
    :doit
    
    REM  
    xcopy /s /c /h /i /d /k /y "C:\Documents and Settings"
    
    @pause
    If you want to copy "ALL" of C drive, then:

    Code:
    set drive=d:\
    :doit
    
    REM  
    xcopy /s /c /h /i /d /k /y "C:\"
    
    @pause
    Thanks goes to Normy, bless his lil heart! (Where is Normy? Has anyone heard from him lately?)

  3. #3
    Junior Member
    Join Date
    Jul 2006
    Posts
    8

    Talking thanks

    Thank you for your help

  4. #4
    Assistant Admin Ken's Avatar
    Join Date
    Dec 1969
    Location
    Tampa
    Posts
    12,043
    No problem. Welcome to SpeedGuide!

  5. #5
    Junior Member
    Join Date
    Jul 2006
    Posts
    8
    I'm having a problem getting the batch file to run on a weekly basis. I went to scheduled tasks under system tools and when the screen to choose the application came up, the batch file wasn't on the list. How do i get around this?

  6. #6
    Junior Member
    Join Date
    Jul 2006
    Posts
    8
    I used the code that you gave me and it gave me an error message:

    C:\Documents and Settings\dts56\Desktop>set drive=d:\
    C:\Documents and Settings\dts56\Desktop>REM
    C:\Documents and Settings\dts56\Desktop>xcopy /s /c /h /i /d /k /y "C:\"
    Cannot perform a cyclic copy
    0 File(s) copied
    Press Any key to continue...

    Any idea why this error appeared?

  7. #7
    Assistant Admin Ken's Avatar
    Join Date
    Dec 1969
    Location
    Tampa
    Posts
    12,043
    Yes, I just checked it out.

    Try this:


    Code:
    set drive=d:\Test
    :doit
    
    REM 
    xcopy /s /c /h /i /d /k /y "\\TheNameofYourComputer\C"
    
    @pause

  8. #8
    Resident Rodent Randy's Avatar
    Join Date
    Jan 2000
    Location
    British Columbia Canada
    Posts
    12,001
    First you have to get married and then everytime she pisses you off you have to write it down you save thease logs in large folders in a large file cabinet within 2- 3 years your cabinet will be over flowing with Batch files


    I was going to post a link to that thread, but the SG search results for "bullsh|t" were too numerous

    sometimes you have to think outside the box to get inside the box .

  9. #9
    Assistant Admin Ken's Avatar
    Join Date
    Dec 1969
    Location
    Tampa
    Posts
    12,043
    Copying C still has some problems. I will have to play with the codes a bit, as soon as I get a chance...

    Do you really need to copy all of C drive?

  10. #10
    Junior Member
    Join Date
    Jul 2006
    Posts
    8

    Unhappy Reply

    Unfortunately, I have to copy all of the 'c' drive. My boss needs it and this is the first time i've used batch files.

  11. #11
    Assistant Admin Ken's Avatar
    Join Date
    Dec 1969
    Location
    Tampa
    Posts
    12,043
    The problem that I see with copying all of c drive is the fact that windows is using some of the components of c drive, so it doesn't want to work... It may have to be ran from a boot disk... I have to leave now. I will see what I can find out tomorrow...

    Maybe someone else can chime in with some help...


    NORMY!!!! Where are you?! DOS STINKS, Normy!!!! DOS STINKS!!!! (That should bring him running! )

  12. #12
    Moderator YeOldeStonecat's Avatar
    Join Date
    Jan 2001
    Location
    Somewhere along the shoreline in New England
    Posts
    50,854
    I'm not aware of any native to windows command line utilities that will hot copy an OS while running.

    Getting some imaging software like Acronis True Image will allow it.
    MORNING WOOD Lumber Company
    Guinness for Strength!!!

  13. #13
    Elite Member Norm's Avatar
    Join Date
    Mar 2001
    Posts
    14,133
    YOSC is right, you can't do it in Win 2K or later without Ghost or True Image type software.

    If the OS is Win98, the freeware app named xxcopy will clone the OS drive using a batch file. Actually very good at it, and after the first run only copies files that have changed or been created, keeping the time to complete very low.

    You can use the native xcopy to get most of the files, but things like the registry files (system, Sam, etc) and files in use (dll's etc) won't be copied, you'll get sharing violations.

  14. #14
    Junior Member
    Join Date
    Jul 2006
    Posts
    8

    Smile

    Will it still work with a Windows XP?

  15. #15
    Elite Member Norm's Avatar
    Join Date
    Mar 2001
    Posts
    14,133
    Quote Originally Posted by denis2006
    Will it still work with a Windows XP?
    If you mean will xxcopy, or xcopy work in XP to copy ALL files from C: (the OS drive) to D: the answer is NO.

    Tell your boss to go out and buy Norton Ghost. Norton Ghost has commandline capabilities you can use in a batch file to clone one drive to another.
    Not sure if True Image has commandline capabilities, maybe someone else knows the answer to that one. I've never used it.

  16. #16
    Elite Member Norm's Avatar
    Join Date
    Mar 2001
    Posts
    14,133
    I knew I heard of something.

    Check this out, it's free. http://www.xxclone.com/itechnot.htm

    And it has commandline support useful in batch files.


    Command line syntax:

    XXCLONE <source> <target> [ switches...]

    where <source> Source volume (e.g., C:)
    <target> Target volume (e.g., D:)

    You may add any of the following switches

    /diag Creates diagnostic file (C:\XXCLONE.DAT)
    /debug Creates a log file (C:\XXCLONE.LOG)
    /start Starts automatically

    (the following switches corresponds the Setup Menu)

    /backup1 Backup Option #1 (Full Backup)
    /backup2 Backup Option #2 (Incremental Backup)
    /backup3 Backup Option #3 (Win Essential Files Only)
    /backup0 Registry Transfer (Without Backup)
    /repair Repair Bootability (No Clone Operations)

    /floppy Creates the Quick Boot Diskette (QBD)
    /walkout Shuts down the computer after completion.


    Note: With /diag option, no volume clone operation will
    take place.


    Command line Example:

    xxclone.exe c: d: /backup2 /start



    It's still beta, but has a good reputation. (I have no experience with it though.)

    Make sure you get the free version.

    Beware:
    When you clone a drive all previous data on your D: drive will be lost on D: and overwritten with what is on C: (an exact duplicate of C:)

  17. #17
    Junior Member
    Join Date
    Jul 2006
    Posts
    8

    Question Question

    is the "XXCLONE <source> <target> [ switches...]" where <source> Source volume (e.g., C <target> Target volume (e.g., D the only code I need to use or do I have to use the /diag /debug /backup1 code as well?

  18. #18
    Elite Member Norm's Avatar
    Join Date
    Mar 2001
    Posts
    14,133
    Sorry, I've never used this xxclone software, don't know what the defaults are set at. I did notice in the documentation that the freeware is NOT fully automatable.
    Get the pro version. $40.00

    From what I have read a command like:

    xxclone.exe c: d: /backup1 /start

    is all you need to make a complete clone of c to d.

    Be very careful with this software. It's not very forgiving. I would try it on a test machine before using it on a production machine. It doesn't just copy files from one drive to another. It makes an exact copy of the source drive on the destination drive. Meaning, any files that 'were' on the destination drive prior to starting the clone will be gone.

    You're on your own from here on. Read all the documentation thoroughly.

  19. #19
    Elite Member Norm's Avatar
    Join Date
    Mar 2001
    Posts
    14,133
    Oh Yes, .........................Ken

    Dos is colorless, and odorless Ken.

    I know you won't find it in the story books, but even pirates have a bath now and again Ken

Similar Threads

  1. Batch Files disable close
    By jorefice in forum Networking Forum
    Replies: 1
    Last Post: 04-23-06, 11:59 AM
  2. Early Unit end
    By thepieman in forum Distributed Computing
    Replies: 4
    Last Post: 08-06-05, 05:45 PM
  3. batch files in linux
    By nightowl in forum Software Forum
    Replies: 1
    Last Post: 05-17-05, 07:33 PM
  4. Checking source codes of image, audio and video files
    By onauc in forum Programming Forum
    Replies: 3
    Last Post: 02-22-05, 12:00 PM
  5. control panel add/remove
    By Sag2734 in forum Software Forum
    Replies: 13
    Last Post: 02-19-05, 09:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •