Click to See Complete Forum and Search --> : Question about making batch files


Frogmire
12-18-2002, 09:48 PM
I'm trying to make a batch file that backs up all my files onto another computer over the network. The problem is one of the files is in c:/documents and settings/all users/.
Now I figured out that when you have a folder that's more than 8 characters you take the first six and tag on "~1" and that refers to that folder. But, what do you do for the "all users" folder? Since the space actually appears in the 4'th place?

Thanks.

Begby
12-19-2002, 09:15 AM
I think you can refer to it as "all users" in quotes. Give it a try.

rock
12-19-2002, 09:44 AM
Putting it all in quotes:
"c:\my documents\all users"
may work just fine. Otherwise, dir /x will soon be your best friend.
c:\dir /x
lists the directory and includes the offical 8.3 name of the files. You'll find that for short names with spaces, the space is dropped and ~1 is appended. In this case, you'll probably need:
c:\mydocu~1\alluse~1
for this directory. Note that if you have multiple files/directories that would shorten to the same 6.3 name, then ~2 etc. are appended. This makes doing it programatically a challenge - but if all you're doing here is setting it up once, you don't need to worry about that.

Frogmire
12-19-2002, 01:24 PM
Thanks you too for your answers. Begby, you can refer to it as that but only in windows, it doesn't seem to work when you try to do something like xcopy in a batch file.

dir /x is my new best friend! Thanks, now I no longer have to wonder about wondering what the dos name of a folder is. :)