Logon script help

Discussion in 'Computer Information' started by gregb369, Dec 17, 2003.

  1. gregb369

    gregb369 Guest

    If I want to write a script that will copy a file to this location:

    C:\Documents and Settings\


    Then I write it like this:


    Copy test.txt c:\docume~1\


    If you want to write it to copy to this location:


    C:\Documents and Settings\Administrator.sun\


    How do you truncate that folder?


    There is a local Administrator folder in Documents and Settings, so C:\
    docume~1\Admini~1\ is not the answer.

    Any thoughts? Thanks.
     
    gregb369, Dec 17, 2003
    #1
    1. Advertisements

  2. C:\docume~1\Admini~2\
     
    Edward Alfert, Dec 17, 2003
    #2
    1. Advertisements

  3. gregb369

    V W Wall Guest

    Put a test file in the place where you want to copy the file. Go to DOS
    and do a directory listing which includes that test file. This will show
    the proper truncated name for the folder. Short filenames are assigned
    numbers in the order they are created, \admini~2 may be correct, but this
    test will tell.

    Virg Wall
     
    V W Wall, Dec 17, 2003
    #3
  4. gregb369

    Oldus Fartus Guest

    Assuming XP, then no. If you are running it in CMD command prompt then
    there is no need to truncate the filenames at all.
    If you need to truncate then the path would be C:\docume~1\Admini~1.sun\
    You were missing the .sun part of the path.

    If you run it using CMD command prompt, and not COMMAND, and then the
    problem will not arise.
     
    Oldus Fartus, Dec 17, 2003
    #4
  5. gregb369

    DeMoN LaG Guest

    The only problem that /may/ arise is that sometimes commands don't
    understand spaces. Example:
    From my laptop to get to my desktop's "program files" folder, I can't type:
    \\jim\c$\program files
    I have to type:
    "\\jim\c$\program files\"

    So enclosing the entire arguments to the command in quotes, example:
    copy "c:\path to file\file.txt" "c:\documents and settings\%username%\"
    is usually advisable.

    --
    AIM: FrznFoodClerk
    email: [email protected]_cast.net (_ = m)
    website: under construction
    Need a technician in the south Jersey area?
    email/IM for rates/services
     
    DeMoN LaG, Dec 17, 2003
    #5
  6. gregb369

    Oldus Fartus Guest

    Yes, I have noticed that - but only when accessing network paths, and
    not on paths on a single computer. I didn't mention it because it did
    not seem relevant, but it certainly does to hurt to make the OP aware of
    it.

    Of course there may come a time when he needs to use his script on a
    network, so it is probably a good habit to get into anyway.
     
    Oldus Fartus, Dec 17, 2003
    #6
  7. gregb369

    Oldus Fartus Guest

    Sorry, that should have read "certainly does NOT hurt.......
     
    Oldus Fartus, Dec 17, 2003
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.