Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Creating a batch file  (Read 2736 times)

0 Members and 1 Guest are viewing this topic.

Matt_H.

  • Guest
Creating a batch file
« on: January 06, 2005, 10:36:11 AM »
I have two files that I need to copy from a network drive to c:\program files\<dir>\  I want to create a batch file to copy these files and overwrite the existing because I don't want to visit at least 30 PC's at 4 different sites to do this update.  What commands will I need to make this work?

Thanks in advance.

Neil



    Expert
  • Fear me Track. Noone can escape my wrath.
  • Thanked: 3
    Re: Creating a batch file
    « Reply #1 on: January 06, 2005, 02:00:28 PM »
    We'll be using the copy command. If you want to get help yourself, you can type copy/?

    The copy command consists of two main parts: source and destination, and some optional "switches". The /y switch supresses overwrite confirmation prompts, so we will use it.

    Here's an example:
    copy "c:\shared files\file.txt" "c:\program files\test" /y

    The first part is the source location and file, the second part is the destination folder. You specify  a file's complete address, followed by its name and extention, then you specify the destination folder, not a file. The /y switch like I said prevents the computer asking to overwrite files.

    It's important that you enclose the addresses in speech marks, or you may get into problems with folder and file names.

    Simple write a copy command for each file you need. There are a few tricks when dealing with large ammounts of files. For example,

    copy "c:\shared files\*.*" "c:\program files\test" /y

    Will copy the entire contents. I hope this helps! Test it works first.

    Matt_H.

    • Guest
    Re: Creating a batch file
    « Reply #2 on: January 06, 2005, 02:14:51 PM »
    Worked perfectly!  Thanks for your help. ;D