Move Command in Batch Files

#1
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?
 


patcooke

Microsoft MVP
Staff member
Premium Supporter
Microsoft MVP
#2
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
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
 


patcooke

Microsoft MVP
Staff member
Premium Supporter
Microsoft MVP
#4
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
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.
 


patcooke

Microsoft MVP
Staff member
Premium Supporter
Microsoft MVP
#6
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
Ok, I appreciate any help you can offer, whenever you have the time.
 


patcooke

Microsoft MVP
Staff member
Premium Supporter
Microsoft MVP
#8
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.
 


This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.