#168952 - 2006-10-05 07:31 PM
Check file exists then copy
|
rparsons
Fresh Scripter
Registered: 2006-10-05
Posts: 6
|
I need to copy a screen saver to the system32 dir of XP & 2000 systems and am trying o figure out how to check for it's existence first so it isn't copied over and over again. Something like IF NOT EXIST (%sysemdir%\screen.scr) COPY "\\server\file" "%sytemdir%\file) END IF.
Can someone give me the right syntax for this? Thanks
|
Top
|
|
|
|
#168953 - 2006-10-05 08:07 PM
Re: Check file exists then copy
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Check for extra information in the kix2010.doc Code:
If NOT Exist("FileOrFolder") Copy "Source" "Destination" /c /h EndIf
|
Top
|
|
|
|
#168956 - 2006-10-05 11:02 PM
Re: Check file exists then copy
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
Becasue Witto so suggested and I'm just pointing out what I think would be a better method.
Quote:
("FileOrFolder")
|
Top
|
|
|
|
#168958 - 2006-10-05 11:46 PM
Re: Check file exists then copy
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
True, I (almost) copied the syntax from the kix2010.doc I tried to show that quotes are missing, that brackets are misplaced and that EndIf is one word. Just what was asked
Quote:
Can someone give me the right syntax for this?
|
Top
|
|
|
|
#168964 - 2006-10-06 03:36 PM
Re: Check file exists then copy
|
rparsons
Fresh Scripter
Registered: 2006-10-05
Posts: 6
|
Thanks. My syntax was based on m ow logic not true kixtart code but it's good to see I was close. Since I am using kixtart for our logon script (active directory), wouldn't the file copy to system32? I would think the script runs under admin context.
|
Top
|
|
|
|
#168966 - 2006-10-06 04:09 PM
Re: Check file exists then copy
|
rparsons
Fresh Scripter
Registered: 2006-10-05
Posts: 6
|
Hmm. Good to know. I have the logic working now and the file is copying. Unfortunately I can see people putting on their on screen saver if its not in system32 or other denied folder (renaming their own). I could use SMS to do this and still may but is there a way to run it as admin?
|
Top
|
|
|
|
#168969 - 2006-10-06 04:24 PM
Re: Check file exists then copy
|
rparsons
Fresh Scripter
Registered: 2006-10-05
Posts: 6
|
Yea, I can limit the screen saver via GPO which I do but a person who knew enough could copy their own and rename it. The best I can think of is just make it read only and hidden in a common location like Program Files.
|
Top
|
|
|
|
#168971 - 2006-10-06 04:36 PM
Re: Check file exists then copy
|
rparsons
Fresh Scripter
Registered: 2006-10-05
Posts: 6
|
I thought about that but wouldn't the permission then get inherited by the receiving computer thereby replacing the permissions?
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 515 anonymous users online.
|
|
|