Move Command in Batch Files

Discussion in 'Windows 7 Software' started by bishop144, Aug 28, 2014.

  1. bishop144

    bishop144 New Member

    Joined:
    May 25, 2014
    Messages:
    11
    Likes Received:
    0
    My colleges' computers reset themselves every night, so we are allowed to install programs and change files & settings at will, because the changes revert on shutdown. I'm trying to create a batch file I can run to copy all the files I use & install the programs I use, I haven't gotten to the programs yet, but I've hit a snag, Whenever I try to run the Copy -y command in a batch file I get "Access Denied" and no other details. Can anyone help?
     
  2. patcooke

    patcooke Microsoft MVP
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    May 16, 2010
    Messages:
    5,455
    Likes Received:
    268
    Which files are you trying to copy and where are the locations from which your are trying to read and to which you are trying to write?
     
  3. bishop144

    bishop144 New Member

    Joined:
    May 25, 2014
    Messages:
    11
    Likes Received:
    0
    The files are on my flash drive, and I'm trying to copy them directly to the desktop. All of the computers use user names like 734 or 722, so i've tried using wildcards ? and * but neither work
     
  4. patcooke

    patcooke Microsoft MVP
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    May 16, 2010
    Messages:
    5,455
    Likes Received:
    268
    Are you saying that you're trying to specify a user folder name with a wildcard in it, such as C:\users\7??\desktop\*.*
     
  5. bishop144

    bishop144 New Member

    Joined:
    May 25, 2014
    Messages:
    11
    Likes Received:
    0
    Ok, ill give an example one of the files I'm trying to get the command to copy is example.jar. I need example.jar copied from the flash drive (lets just use letter J) J:\ to C:\Users\7??\Desktop. I'm using wildcards as a representation, each different lab of computers has a different username some are 733 some are 718. So you get on the computer in one lab and everyones' username is 733 where in another lab everyones name is 718. I need this command to be able to run on all of the computers.
     
  6. patcooke

    patcooke Microsoft MVP
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    May 16, 2010
    Messages:
    5,455
    Likes Received:
    268
    You need a different command structure to use wildcards in folders and directories. I'm up to my neck in things at the moment - I'll get back to you asap.
     
  7. bishop144

    bishop144 New Member

    Joined:
    May 25, 2014
    Messages:
    11
    Likes Received:
    0
    Ok, I appreciate any help you can offer, whenever you have the time.
     
  8. patcooke

    patcooke Microsoft MVP
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    May 16, 2010
    Messages:
    5,455
    Likes Received:
    268
    This command:

    for /d %%a in (C:\users\7*) do copy J:\*.* %%a\desktop\

    will copy all files from the root of a drive J to the desktop folder of any user beginning with the digit 7.
     

Share This Page

Loading...