Script to copy a desktop s/cut via login script.

Discussion in 'Scripting' started by Fred Bloggs, Jan 4, 2010.

  1. Fred Bloggs

    Fred Bloggs Guest

    Hi,
    I'm trying to get a desktop shortcut pushed out to all users on the network
    here, and I've stumbled across this line to add to the login script to do
    so.

    xcopy \\myDC\NETLOGON\DESKTOP ICONS C:\Documents and Settings\All
    Users\Desktop /d /y

    my issue is that we have setup the offline sync of mydocs etc and this path
    does not exist on every ones pc.

    The path it need to go to is going to be C:\users\user.name\desktop

    What chane needs to be made to the code to automatically add the shortcut to
    anyone's desktop who logs into the pc.

    Many thanks
     
    Fred Bloggs, Jan 4, 2010
    #1
    1. Advertisements

  2. You need to replace

    C:\Documents and Settings\All Users\Desktop
    with
    %UserProfile%
    or with
    %AllUsersProfile%
    depending on which folder you prefer. Note also that the command

    xcopy \\myDC\NETLOGON\DESKTOP ICONS C:\Documents and Settings\All
    Users\Desktop

    will fail. It should read

    xcopy "\\myDC\NETLOGON\DESKTOP ICONS" "C:\Documents and Settings\All
    Users\Desktop"

    or perhaps

    xcopy "\\myDC\NETLOGON\DESKTOP ICONS" "%AllUsersProfile%\Desktop"
     
    Pegasus [MVP], Jan 4, 2010
    #2
    1. Advertisements

  3. Fred Bloggs

    Fred Bloggs Guest

    I meant to say that users have redirected folders
     
    Fred Bloggs, Jan 4, 2010
    #3
  4. Fred Bloggs

    Fred Bloggs Guest

    Thanks for the script, but what if there is no all users directory as such,
    it's hidden, locked and is redirected to the server where things are sync'ed
    to.
    Is there anyway aside of using "all users" and to use the folder of who ever
    is logging in?

    Many thanks
     
    Fred Bloggs, Jan 4, 2010
    #4
  5. Yes, use %UserProfile% as mentioned.

     
    Pegasus [MVP], Jan 4, 2010
    #5
  6. Fred Bloggs

    Fred Bloggs Guest

    Hi Pegasus, thats working now, many thanks.

    one question though, is there a switch to use in the command to
    automatically overwrite the file being copied?
    I'm intending to include the line in my login script, but don't want the
    users to see a dos prompt each day saying "do you want to overwrite" etc.

    Many thanks.
     
    Fred Bloggs, Jan 4, 2010
    #6
  7. There are numerous switches in xcopy, including one to suppress the
    overwrite prompt. Type xcopy /? at the Command Prompt to see them all.
     
    Pegasus [MVP], Jan 4, 2010
    #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.