Results 1 to 11 of 11
  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Copying CD to Desktop (XP Home)

    I need to create a batch file (called from an Autorun file on a CD) that copies a folder on the CD to the target computer's desktop -- all without help from the computer operator.
    I assume it would look something like the following, but what do I put in for the ???? that specifies the target computer's desktop on any computer?


    Copy D:CDFolder C:????Desktop

  2. #2
    Gold Lounger Rebel's Avatar
    Join Date
    Jul 2001
    Location
    Canada
    Posts
    3,024
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Copying CD to Desktop (XP Home)

    Hi Chuck,
    This may be what you're looking for. Scroll about 3/4 down the page and have a look at the "accepted answer". HTH.
    John
    A Child's Mind, Once Stretched by Imagination...
    Never Regains Its Original Dimensions

  3. #3
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Copying CD to Desktop (XP Home)

    Thanks John,

    Using %allusersprofile%Desktop works. However, is there a way to get to the current user's profile rather than all users?

  4. #4
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    20,611
    Thanks
    2
    Thanked 623 Times in 557 Posts

    Re: Copying CD to Desktop (XP Home)

    See Microsoft Windows XP - Command shell overview for a listing of environment variables.

    Joe

  5. #5
    Gold Lounger Rebel's Avatar
    Join Date
    Jul 2001
    Location
    Canada
    Posts
    3,024
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Copying CD to Desktop (XP Home)

    Does %userprofile% work?
    John
    A Child's Mind, Once Stretched by Imagination...
    Never Regains Its Original Dimensions

  6. #6
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Copying CD to Desktop (XP Home)

    %userprofile% and %homepath% both return the user's path (Documents and Settings/User). However, I'm finding it a bit tricky to use them. CD %userprofile% works, but it looks like sometimes in other commands you have enclose %userprofile% in quotes. I'm still sitting here in the DOS Cmd window trying out various commands to see what works and what doesn't. I haven't written a DOS batch file in several years, and my old memory isn't working too well.

  7. #7
    Gold Lounger Rebel's Avatar
    Join Date
    Jul 2001
    Location
    Canada
    Posts
    3,024
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Copying CD to Desktop (XP Home)

    <img src=/S/megashout.gif border=0 alt=megashout width=33 height=17> <big> <!profile=JohnGray>JohnGray<!/profile> </big>(resident Batch File expert) - <big> HELP !!! </big>
    John
    A Child's Mind, Once Stretched by Imagination...
    Never Regains Its Original Dimensions

  8. #8
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Copying CD to Desktop (XP Home)

    Someone called?! Sorry, was out last night seeing Guys and Dolls...

    The two points to bear in mind are that:
    1. <LI>the computer doesn't have a desktop, the user does, and<LI>if there is any possibility of a blank appearing in a folder name, then the entire path should be enclosed in double quotes for any DOS-type command. It doesn't hurt to do this as a routine measure.
    So my first draft of a BATch file for your requirement would be:<pre>copy /y "CDFolder*.*" "%userprofile%Desktop"
    attrib -r "%userprofile%Desktop*.*"</pre>

    If the BATch file lives on the CD and is run from there, there is no need to supply a drive letter for the CD. The /y switch will overwrite an identically-named folder on the desktop (say on a second run). Attrib removes the read-only attribute from the files copied to the user's Desktop (and any other desktop files (which are unlikely to have it), too!). I've used two blanks in the commands simply to separate the fields more obviously, but only one is necessary.

    Have a try to see if that does what you want!

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  9. #9
    Gold Lounger Rebel's Avatar
    Join Date
    Jul 2001
    Location
    Canada
    Posts
    3,024
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Copying CD to Desktop (XP Home)

    Thanks John. Hopefully <!profile=Chuck Tucker>Chuck Tucker<!/profile> will see this.
    John
    A Child's Mind, Once Stretched by Imagination...
    Never Regains Its Original Dimensions

  10. #10
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Copying CD to Desktop (XP Home)

    Thanks for all the help. I finally got it working perfectly. Found out I had to use this syntax "%homepath%"desktop, i.e. enclose homepath in quotes as it results in a folder name that includes spaces.

    I also tried the "new" batch command choice, but it didn't work. Perhaps I'm running an older version of DOS?

  11. #11
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    20,611
    Thanks
    2
    Thanked 623 Times in 557 Posts

    Re: Copying CD to Desktop (XP Home)

    See <post:=562,374>post 562,374</post:> for John's comment on quotation marks. And you are not running any DOS at all with XP. There is just a command windows that looks a lot like DOS. Anyone running XP is running the same basic version. The only difference might be the service pack level.

    Joe

Posting Permissions

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