Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Hatsukaichi, Hiroshima, Japan
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy-Command in Bat Files (XP PRo (SP1))

    I'm not sure why but I'm having trouble with the command line. I discovered it while trying to write a batch file. 'Copy' is not recognised as a command in the run box. I typed: copy /? and got the message below. Could this be anything to do with environment variables (I think I remember Big Al helping me out with this once). I can copy by drag and drop but I'd like to automate copying of certain files with a batch file.

    Thanks

    Chris (Hunt)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Copy-Command in Bat Files (XP PRo (SP1))

    You state that
    <hr>'Copy' is not recognised as a command in the run box.<hr>
    That is correct, you shouldn't type it into the Run box but into a command prompt window. Select Start | All Programs | Accessories | Command Prompt, and try there.

  3. #3
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Copy-Command in Bat Files (XP PRo (SP1))

    If you want to copy a file from the Windows Run box as a single command, you have to specify the executable (CMD.EXE) then the command you want to execute, using the /c switch. Example:

    cmd.exe /c copy C:Text1.txt C:Text2.txt

    Executing this command from Run box will copy a file named Text1.txt in C: root directory to a file named Text2.txt in same location. The Command Prompt window will briefly open, execute the command, and close again. Note: If used, the /c switch must appear immediately before the command string. Any other command line arguments for CMD.EXE must precede the /c option.

    Note that CMD.EXE is the new command shell introduced in Windows NT. Do not confuse it with the primitive MS-DOS COMMAND.COM command shell program (which is still to be found on WIN XP systems).

    HTH

  4. #4
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Hatsukaichi, Hiroshima, Japan
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy-Command in Bat Files (XP PRo (SP1))

    Thank you both. I was confusing the run box with command prompt but the tip to include the CMD.EXE command in the run box looks very promising. I also realised with the batch file I was making that the command I needed was xcopy.

    All the best,

    Chris

Posting Permissions

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