Page 1 of 1 1
Topic Options
#31438 - 2002-10-28 04:01 PM Deleting a folder's contents and copying a new one down
Zoon Offline
Fresh Scripter

Registered: 2002-10-23
Posts: 6
I tried to write the following code, but I'm not sure I have the syntax correct. The script runs without error (I know because its printing the text in the AT(x,x) command) but it doesnt do what its supposed to.

The user accounts are domain users only, all logging on to Windows XP. I am trying to copy down one of two different desktops based on the user group they are in. The path to the desktop is therefore c:\documents and settings\'+@SERID++'\desktop - however I think I have the syntax wrong somewhere.

Could someone please show me the error of my ways ? [Smile]

code:
If INGROUP("KS1")
use X: \\SCHOOLNT\KS1DESKTOP
del "C:\DOCUMENTS AND SETTINGS\'+@USERID+'\DESKTOP\*.*"
copy "X:\*.*" "C:\DOCUMENTS AND SETTINGS\'+@USERID+'\DESKTOP"
use X: /d
AT(3,4) "KS1"
ENDIF

If INGROUP("KS2")
use X: \\SCHOOLNT\KS2DESKTOP
del "C:\DOCUMENTS AND SETTINGS\'+@USERID+'\ALLUSERS\DESKTOP\*.*"
copy "X:\*.*" "C:\DOCUMENTS AND SETTINGS\'+@USERID+'\DESKTOP"
use X: /d
AT(3,4) "KS2"
ENDIF

AT(5,4) "RAN"


Top
#31439 - 2002-10-28 04:06 PM Re: Deleting a folder's contents and copying a new one down
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, instead of "documents and..." use the env variable: %userprofile%...

ah, quick rewrite to see if there is more errors...
code:
If INGROUP("KS1")
del "%userprofile%\DESKTOP\*.*"
copy "\\SCHOOLNT\KS1DESKTOP\*.*" "%userprofile%\DESKTOP"
AT(3,4) "KS1"
ENDIF

If INGROUP("KS2")
del "%alluserprofile%\DESKTOP\*.*"
copy "\\SCHOOLNT\KS2DESKTOP\*.*" "%alluserprofile%\DESKTOP"
AT(3,4) "KS2"
ENDIF

AT(5,4) "RAN"

what about that...
_________________________
!

download KiXnet

Top
#31440 - 2002-10-28 04:07 PM Re: Deleting a folder's contents and copying a new one down
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Think you just got your quotes messed-up a bit, try this untested revision to your script:

Break On

If INGROUP("KS1")
 use X: \\SCHOOLNT\KS1DESKTOP
 del "C:\DOCUMENTS AND SETTINGS\"+@USERID+"\DESKTOP\*.*"
 copy "X:\*.*" "C:\DOCUMENTS AND SETTINGS\"+@USERID+"\DESKTOP"
 use X: /d
 AT(3,4) "KS1"
ENDIF

If INGROUP("KS2")
 use X: \\SCHOOLNT\KS2DESKTOP
 del "C:\DOCUMENTS AND SETTINGS\"+@USERID+"\ALLUSERS\DESKTOP\*.*"
 copy "X:\*.*" "C:\DOCUMENTS AND SETTINGS\"+@USERID+"\DESKTOP"
 use X: /d
 AT(3,4) "KS2"
ENDIF

AT(5,4) "RAN"

exit


Hope this helps

-Shawn

Top
#31441 - 2002-10-28 04:09 PM Re: Deleting a folder's contents and copying a new one down
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
All of this would only work if the user has admin rights, which should not be the case in a school setting.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#31442 - 2002-10-28 04:12 PM Re: Deleting a folder's contents and copying a new one down
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
les?
all?
I quessed that the first part was for students and the latter for teachers as it requires more rights. at least on w2k.
_________________________
!

download KiXnet

Top
#31443 - 2002-10-28 04:27 PM Re: Deleting a folder's contents and copying a new one down
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Firstly, I said "all".

Second, IMHO no student should have rights to their desktop and teachers should not have to logon to every machine to configure it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#31444 - 2002-10-28 04:42 PM Re: Deleting a folder's contents and copying a new one down
Zoon Offline
Fresh Scripter

Registered: 2002-10-23
Posts: 6
Students would have rights on their on desktop folder, which is why I am putting it into their own instead of into all users [Smile] They are primary school ('elementary' to you US peeps ? ages 5 to 11). We are also using Fortres CleanSlate so any modification except files saved to the network mapped U: drive will be reset on reboot.

Thanks to all, lonkero's code was the first I tried, and it works perfectly [Smile]

Now I just gotta passdown a policy file that enforces the desktop wallpaper and create 250 users lol !

PS : The first group is Key Skills 1, the second Key Skills 2; the desktop shortcuts copied down are for programs installed on all machines, but to give desktop shortcuts only for the programs they need. Teachers, well I havent decided yet [Big Grin]

[ 28. October 2002, 16:46: Message edited by: Zoon ]

Top
#31445 - 2002-10-28 05:44 PM Re: Deleting a folder's contents and copying a new one down
Rocco Capra Offline
Hey THIS is FUN
*****

Registered: 2002-04-01
Posts: 380
Loc: Mansfield Ohio
I'm [Confused] ...
What is...
"C:\DOCUMENTS AND SETTINGS\'+@USERID+'\ALLUSERS\DESKTOP\"...?

I run XP and have a spare 2K box and there is no...
"C:\DOCUMENTS AND SETTINGS\RCapra\ALLUSERS\DESKTOP\"

But I do have...
"C:\DOCUMENTS AND SETTINGS\RCapra\DESKTOP\"
and...
"C:\DOCUMENTS AND SETTINGS\ALL USERS\DESKTOP\"

I'm guessing that is a typo?! [Confused]

Rocco
_________________________
I Love this board!! -------------------- My DEV PC is running KIX 4.22 WINXP Pro

Top
#31446 - 2002-10-28 06:17 PM Re: Deleting a folder's contents and copying a new one down
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Sharp eye there Rocco! [Eek!]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#31447 - 2002-10-28 06:55 PM Re: Deleting a folder's contents and copying a new one down
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
rocco, quess why I did rewrite the whole script...
_________________________
!

download KiXnet

Top
#31448 - 2002-10-28 08:41 PM Re: Deleting a folder's contents and copying a new one down
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Sharp eye there Jooel, and a tongue to match! [Big Grin]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#31449 - 2002-10-29 11:24 AM Re: Deleting a folder's contents and copying a new one down
Zoon Offline
Fresh Scripter

Registered: 2002-10-23
Posts: 6
Nice spot rocco - at first I wanted to put it in all users, and then I remembered that a standard user might not have full rights to that folder, so I edited the script. Obviously I missed one bit hehehehe
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 895 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.064 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org