Link to home
Start Free TrialLog in
Avatar of kylemorgans
kylemorgans

asked on

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
Avatar of Bartender_1
Bartender_1
Flag of Canada image

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
ASKER CERTIFIED SOLUTION
Avatar of Bartender_1
Bartender_1
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kylemorgans
kylemorgans

ASKER

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
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
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?
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
perfect thanks man
Thanks for the points!

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

Cheers!

:o)

Bartender_1