Batch Files

Posted on 2007-10-12
Last Modified: 2010-04-16
How to create a batch file to move files from one location to another?
Question by:wilsonhinds
    LVL 8

    Accepted Solution

    Create an empty (text) file, rename is to filename.bat
    Right-click on file en choose 'edit'

    paste a string like this to copy a file:

    copy C:\test.txt  D:\test.txt

    Is this what you need?
    LVL 1

    Expert Comment

    You may need to go to My Computer >  Tools > Folder Options > View
    Uncheck "Hide extensions for known file types"

    Now you can rename the text file.

    If you want to use it to do a backup the xcopy command is fairly useful

    type in something like

    Now create a blank text file (right click > new > New Empty Text File)

    Rename it to copy.bat

    then type the follwing in the file - replacing the path ie c:\ with where you want to copy from & to
    xcopy "c:\test" "d:\test" /d /s /c /y

    This will copy all the files in a directory to a new one, it will also copy all the files that have changed since the last time you ran the command (incremental backup) it will keep copying if errors occur - files that are in use and it will overwrite the destination without prompting

    This method just makes things easy


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
    Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
    Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
    Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now