Question about making batch files

Sharky Forums


Results 1 to 4 of 4

Thread: Question about making batch files

  1. #1
    Tiger Shark Frogmire's Avatar
    Join Date
    Nov 2002
    Location
    Canada
    Posts
    523

    Question about making batch files

    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.

  2. #2
    Reef Shark
    Join Date
    Apr 2001
    Location
    Traverse City, MI, USA
    Posts
    305
    I think you can refer to it as "all users" in quotes. Give it a try.
    --------------------
    When you were born you cried and the world smiled. Live your life so that when you die you smile and the world cries.

  3. #3
    NullPointerException rock's Avatar
    Join Date
    Sep 2000
    Location
    York, PA
    Posts
    6,203
    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.

    Open Source is free like a puppy is free.

    It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.

    Understanding Evolution

  4. #4
    Tiger Shark Frogmire's Avatar
    Join Date
    Nov 2002
    Location
    Canada
    Posts
    523
    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.

Posting Permissions

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