login script to add desktop icons won't add folder


I have a login script on my w2k domain mapping network drives and it also calls a command that adds icons to the desktop.

i almost have it right but it will only add files and not a folder.
this is the command that runs

copy H:\desktopicons\folder\* "%USERPROFILE%\desktop"

it is working right except that it won't add a folder

Please help
kylemorgansAsked:
Who is Participating?
 
Christopher McKayConnect With a Mentor Microsoft Network AdministratorCommented:
Or you could just use the xcopy command instead of the copy command:

xcopy H:\desktopicons\folder\* "%USERPROFILE%\desktop"


Not sure why I didn't think of that first. ~LOL~

:o)

Bartender_1
0
 
Christopher McKayMicrosoft Network AdministratorCommented:
add a line to your script that creates the folder if it doesn't already exist:
if not exist "c:\%userprofile%\desktop\<foldername>" md "c:\%userprofile%\desktop\<foldername>"

Hope this helps!

:o)

Bartender_1
0
 
kylemorgansAuthor Commented:
i tried the xcopy command and that disn't seem to work

but i am working on making it create the folder but i might need a lil more help with that
 
thanksa
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
Christopher McKayMicrosoft Network AdministratorCommented:
Have you tried the xcopy command with the /e switch?

xcopy H:\desktopicons\folder\* "%USERPROFILE%\desktop" /e

(This forces xcopy to copy the directory even if it's empty)

:o)

Bartender_1
0
 
kylemorgansAuthor Commented:
the /e switch works

do  u know how to have the folder be deleted when the user logs off and then with they log back on to create the file again .   the /e command asks them if they want to overwrite the file when they log back in and that isn't good for the users u know?
0
 
Christopher McKayMicrosoft Network AdministratorCommented:
You could use the /y switch to suppress the "do you want to overwrite" message, and automatically overwrites:

xcopy H:\desktopicons\folder\* "%USERPROFILE%\desktop" /e /y

You would need to create a log off script to delete the directory, if you don't wish to use the "/y" option.

:o)

Bartender_1
0
 
kylemorgansAuthor Commented:
perfect thanks man
0
 
Christopher McKayMicrosoft Network AdministratorCommented:
Thanks for the points!

I'm glad I was able to be of assistance.

Cheers!

:o)

Bartender_1
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.