#27180 - 2002-08-16 12:33 AM
Copying a file
|
DrUltima
Fresh Scripter
Registered: 2002-08-16
Posts: 21
Loc: Nashville, TN, USA
|
OK, this is my first post, so please be kind.
For starters, here is the portion of my script that troubles me: ----------- if $ClientType="Windows 2000 Professional" if exists("C:\IP3.ico")=0 Copy "\\BSCApp01\NetLogon\IP3.ico" "C:\IP3.ico" ? "Copying IP Icon to local Workstation." endif if exists("%ALLUSERSPROFILE%\Desktop\Welcome to Interactive Practice.url")=0 Copy "\\BSC1App01\NetLogon\Welcome to Interactive Practice.url" "%ALLUSERSPROFILE%\Desktop\Welcome to Interactive Practice.url" ? "Copying Shortcut for the Interactive Practice to your Desktop." endif endif -------------- The script actually copies the .url file as it is supposed to, and the text message saying the .ico file transmits, but it does not actually copy the .ico file to "c:\"
Any guideance for the newbie?
|
|
Top
|
|
|
|
#27182 - 2002-08-16 12:43 AM
Re: Copying a file
|
Sealeopard
KiX Master
   
Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
|
First of all, if you post your code between CODE tags, then you preserve your formatting.
Secondly, you have a syntax error, it EXIST not EXISTS.
So, your improved script would look like this:
code:
if $ClientType="Windows 2000 Professional" if not exist("C:\IP3.ico") ? "Copying IP Icon to local Workstation." Copy "\\BSCApp01\NetLogon\IP3.ico" "C:\IP3.ico" ? ''+@ERROR+' - '+@SERROR endif if not exist("%ALLUSERSPROFILE%\Desktop\Welcome to Interactive Practice.url") ? "Copying Shortcut for the Interactive Practice to your Desktop." Copy "\\BSC1App01\NetLogon\Welcome to Interactive Practice.url" "%ALLUSERSPROFILE%\Desktop\Welcome to Interactive Practice.url" ? ''+@ERROR+' - '+@SERROR endif endif
Finally, be aware that copying to the 'All Users' profile will most likely require administrative permissions. I would alos not copy the icon into the root directory but for example %WINDIR% or %WINDIR%\SYSTEM32 [ 16. August 2002, 00:45: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.
|
|
Top
|
|
|
|
#27183 - 2002-08-16 07:59 PM
Re: Copying a file
|
DrUltima
Fresh Scripter
Registered: 2002-08-16
Posts: 21
Loc: Nashville, TN, USA
|
Thanks to you both! I had a bad server name in the .ico path. I don't know how many times I looked at that and still did not see it. Error code returned it.
Sealeopard, you were correct about not wanting to place the icon file on root and about the permissions problem on the %ALLUSERSPROFILE%. I found command variable on TechNet in an article called Command Shell OVerview. I used it because I did not see a good way to get past defining the specific user directory. Now that I look again, I see a %USERPROFILE% (not sure how I missed it the first time), so I changed the code to:
code:
if $ClientType="Windows 2000 Professional" if exist("%USERPROFILE%\IP3.ico")=0 ? "Copying IP Icon to local Workstation." Copy "\\BSC1App01\NetLogon\IP3.ico" "%USERPROFILE%\IP3.ico" ? ''+@ERROR+' - '+@SERROR endif if exist("%USERPROFILE%\Desktop\Welcome to Interactive Practice.url")=0 ? "Copying Shortcut for the Interactive Practice to your Desktop." Copy "\\BSC1App01\NetLogon\Welcome to Interactive Practice.url" "%USERPROFILE%\Desktop\Welcome to Interactive Practice.url" ? ''+@ERROR+' - '+@SERROR endif endif
That seemed to work very well. Any pointers appreciated. Thanks again.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|