|
|
 |
|
|
Pages: 1
Batch File
(Click here to view the original thread with full colors/images)
Posted by: Mea Culpa
I have to constanly move files, so I hear of something call Batch file. I am new to batch file so I am trying to create a batch file that will copy all of the files in a certain directory (e.g C:\My Documents\MyFiles\) and place then in the current directory where the Batch file resides(e.g C:\My Documents\NewDirectory)
I don't know what I am doing wrong but everytime I try to I get error messages.. This so far what I have been trying..
@echo on
copy C:\My Documents\MyFiles\*.* %1
pause
I always get the DOS error message saying that the system could not find the file(s).
Can some one please give me an example or tell me what I am doing wrong so I can do this operation.
Posted by: VmanBeBop
if you are doing this in Windows 9x and even maybe windows ME, you have to use DOS notation. All file or directory names have to be 8 characters or shorter. So when DOS reads all of your directories and files it has to display everything in 8 letters or less. The general rule is that if a file or folder name is 8 characters or less (excluding spaces), you take the spaces out of the name and you get the DOS name of the file or directory. However, if it is greater than 8 you take out all of the spaces. Then you take the first six letters and add a squiggly thing (~) found on the upper left hand corner of your keyboard and then add the number of that folder. So if there are two folders somewhere and one is named My Videos From Next Year and My Videos From Last Year, and say My Videos From Last Year was created first, its name would be MYVIDE~1 and My Videos From Next Year would be named MYVIDE~2. So your second line should be changed to:
COPY C:\MYDOCU~1\MYFILES\*.* %1.
Posted by: Outlaw
I'd put it like this:
copy "C:\My Documents\MyFiles\*.*" .
pause
@echo on isn't necessary, it's always on unless you manually turn it off first. I replaced your %1 with a dot, %1 is used for variables, the dot wil copy it to the current dir. And as you can see, I put the path in quotes so it will recognise the spaces as a part of it.
I think that should work, didn't try it though... If you need any more help, just ask.
|
|
|
|
|