Sverre
|
(Getting the hang of it)
|
2002-09-30 12:40 AM
|
|
|
|
|
Copying files
|
|
I am copying certain files from the netlogon share to the local users harddisk, all of them work just fine except this one:
$dir=ReadValue("HKEY_LOCAL_MACHINE\software\microsoft\windows NT\currentversion", "SystemRoot") Copy "%0\..\ls.bmp" $dir
What am I doing wrong here? All users have admin privileges on their local machine. If I run the script after the user is logged on it works fine.
|
|
Re: Copying files
|
|
the basic troubleshooting steps that I would employ are:
1) print the command to verify it looks proper. Add something like ? 'Copy "%0\..\ls.bmp" $dir' before the copy command.
2) Add '? @error @serror" after the COPY command to determine why the coomand is failing.
|
Sverre
|
(Getting the hang of it)
|
2002-09-29 02:50 PM
|
|
|
|
|
Re: Copying files
|
|
The reply is: 2 The system can not find the file specified
I have even tried writing: copy ls.bmp c:\winnt and it gets the same error messages
The script is ok, it works with me (but I'm a member of the domain admins) and it also works for the users if the script is run AFTER they log on and have Windows up and running.
|
|
Re: Copying files
|
|
What OS? XP has some issues with %0. When you print the copy command does it look properly formed? The error you specified, "2", would indicate to me a problem with the first paramter of the copy command, not the second.
|
|
Re: Copying files
|
|
In your previous example you stated you tried "copy ls.bmp c:\winnt" what is the path for ls.bmp? Use quotes around each parameter.
|
Sverre
|
(Getting the hang of it)
|
2002-09-29 03:26 PM
|
|
|
|
|
Re: Copying files
|
|
The problem seems to be on any machines as long as the user don't have domain admin rights.
Other copy commands with %0/../ works just fine.
The ls.bmp resides in the netlogon directory.
I did not use quotes around the parameters: copy ls.bmp c:\winnt. But since it works when I log on as a domain admin I figure the problem isn't there, but rather something to do with the user rights. The authenticated users has read/write/execute rights to the netlogon directory and I even tried giving everyone full rights, but it didn't help.
|
|
Re: Copying files
|
|
If the logon script can execute from the netlogon directory, then there should not be a permissions problem there. Error 2 indicates a path issue. Does the file have any specific permission or attributes? If the user lacked permissions, I would have expected an error 5 (Access Denied).
Change your copy command to copy to "%temp%" to avoid permission issues on the destination. Does that work?
|
Sverre
|
(Getting the hang of it)
|
2002-09-29 03:55 PM
|
|
|
|
|
Re: Copying files
|
|
Have tried copying to "c:\temp", nothing there (works for domain admins).
Tried giving everyone full control of the file, still nothing there.
As far as I can understand there has to be something in the way things work when they log on. Obviously the file isn't accessible to the user during the login, it is after the login has been done, but not until the explorer is up. The strange thing is that it's accessible to a domain admin during the login process both on an XP and a W2K machine.
|
|
Re: Copying files
|
|
the user may not have access to c:\temp. On W2K and XP %temp% is not c:\temp.
|
|
Re: Copying files
|
|
Create a new text file and place it in the netlogon directory. Try to copy it to "%temp%" (Use the environment variable). Does that work?
|
|
Re: Copying files
|
|
Maybe this won't help, but who knows... Is the file already there (on the destination)? Is it read-only? Have you tried hard-coding the "C:\WINNT" instead of reading it from the registry just to see if it works? If it does, you'll have to use regedt32 (not regedit) and check that registry key's permissions. Don't know if any of this will help, because it's weird that the same operation works after the user is logged on!
|
Sverre
|
(Getting the hang of it)
|
2002-09-29 05:01 PM
|
|
|
|
|
Re: Copying files
|
|
Tried it with c:\winnt and it doesn't help.
Tried it with a text file "test.txt" and it doesn't work.
I copy some files from the same location a couple of rows above where this is and it works (to a different directory).
Tried to put the file in another folder under netlogon and it doesn't work.
I'm completely out of ideas.
|
Les
|
(KiX Master)
|
2002-09-29 05:11 PM
|
|
|
|
|
Re: Copying files
|
|
I can't see %0\.. working from KiX. From a batch file yes...
Try using one of the KiX macros
@ScriptDir @StartDir @LServer @LDrive @CurDir
|
Sverre
|
(Getting the hang of it)
|
2002-09-29 05:12 PM
|
|
|
|
|
Re: Copying files
|
|
Tried to post the script but it only complains about HTML tags, I REALLY hate that!
|
Sverre
|
(Getting the hang of it)
|
2002-09-29 05:14 PM
|
|
|
|
|
Re: Copying files
|
|
It works well other places in the script? And I get the same problem if I don't use %0\.., so I expect it is something else.
|
Lonkero
|
(KiX Master Guru)
|
2002-09-29 05:16 PM
|
|
|
|
|
Re: Copying files
|
|
  did you try with @scriptdir?  
|
|
Re: Copying files
|
|
Print the values you're getting, (don't assume you know them!), then run this:
code:
CACLS folder_or_file_path
on all 3 items: source file, target path, target file. Then post the resulting outputs here... [ 29. September 2002, 17:23: Message edited by: Fernando Madruga ]
|
|
Re: Copying files
|
|
BTW: you're probably not using the code tags around your code when posting. Look below the text box and find the "CODE" button and use it to insert the proper tags; then paste your code in between those two tags.
|
Les
|
(KiX Master)
|
2002-09-29 05:25 PM
|
|
|
|
|
Re: Copying files
|
|
To post code, insert between code taags. That should solve the complaints about HTML tags.
The %0\.. thing would only work if calling KiX from a batch file and then only if you close it with another % like this.
"%0\..%"
|
Sverre
|
(Getting the hang of it)
|
2002-09-29 05:28 PM
|
|
|
|
|
Re: Copying files
|
|
Source file is
n:\ls.bmp Everyone:F Everyone:R NT AUTHORITY\Authenticated Users:R R BUILTIN\Administrators:F NT AUTHORITY\SYSTEM:F
Source path is
n:\ Everyone:(OI)(CI)R NT AUTHORITY\Authenticated Users:R NT AUTHORITY\Authenticated Users:(OI)(CI)(IO)(special access:) GENERIC_READ GENERIC_EXECUTE
R (OI)(CI)(IO)(special access:) GENERIC_READ GENERIC_EXECUTE
BUILTIN\Administrators:F BUILTIN\Administrators:(OI)(CI)(IO)F NT AUTHORITY\SYSTEM:F NT AUTHORITY\SYSTEM:(OI)(CI)(IO)F CREATOR OWNER:(OI)(CI)(IO)F
Target path is (they have admin rights on local PC)
c:\WINDOWS BUILTIN\Users:R BUILTIN\Users:(OI)(CI)(IO)(special access:) GENERIC_READ GENERIC_EXECUTE
BUILTIN\Power Users:C BUILTIN\Power Users:(OI)(CI)(IO)C BUILTIN\Administrators:F BUILTIN\Administrators:(OI)(CI)(IO)F NT AUTHORITY\SYSTEM:F NT AUTHORITY\SYSTEM:(OI)(CI)(IO)F BUILTIN\Administrators:F CREATOR OWNER:(OI)(CI)(IO)F
Target file doesn't exist.
|
Sverre
|
(Getting the hang of it)
|
2002-09-29 05:29 PM
|
|
|
|
|
Re: Copying files
|
|
Here is the script
code:
;**** **** ;**** Login script for Lorentzen & Stemoco **** ;**** Made 21-22 Sep 2002 by Sverre Munthe **** ;**** Copyright (c) 2002, Lorentzen & Stemoco **** ;**** This script will only work with WinNT or better **** ;**** **** ;**** MunSve 27.09.2002 Added support for Symantec live update **** ;**** MunSve 29.09.2002 Something wrong with copying ls.bmp **** ;**** MunSve 29.09.2002 WinXP machines don't get @primarygroup **** ;**** ****
;**** ;**** Setting a few variables for the script ;**** setoption("hidecursor", "on") settitle("Hi " +@fullname + " you are now being logged on to Lornet, please wait this shouldn't take long") if ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "RunLogonScriptSync") <> 1 $value = WriteValue ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "RunLogonScriptSync", "1", "REG_DWORD") endif
;**** ;**** Checking if this is the first time this machine ;**** has logged on to the domain, if it is a file is ;**** created and a line is made about the logon time, ;**** if it isn't a line is made in the file about time ;**** $firsttime = 0 $file = "%0\..\Users\" + @userid + ".log" if open(1, $file, 4) <> 0 if open(1, $file, 5) = 0 $txt = writeline(1, "First time logged on to domain " + @date + " " + @time + @crlf) $firsttime = 1 endif else $txt = writeline(1, "Logged on to domain from workstation " + @wksta + " " + @date + " " + @time + @crlf) endif
;**** ;**** Making a welcome message if this is the first time ;**** if $firsttime=1 Small Color b+/n Box (0,0,24,79,GRID) Color g/w+ Box (0,9,24,70,FULL) Color n/w+ AT (1,11) " Welcome to the Lornet domain! " AT (3,11) " Since this is the first time you are logging on we will " AT (4,11) " take some time informing you about the Lornet domain as " AT (5,11) " well as what we in the IT-department can help you with. " AT (7,11) " The domain Lornet consists of 6 servers that all work " AT (8,11) " together to give you the best working solution possible " AT (9,11) "The file-server is where you will save your work and also" AT (10,11) " run some of your more special programs from " AT (11,11) "The Exchange-server is where all the e-mail is collected." AT (12,11) "The MRS-server collects all the e-mail from the Exchange-" AT (13,11) " server and also receives faxes. " AT (14,11) " The SQL-server collects, and stores, all the messages " AT (15,11) " for the Strategic software from the MRS-server. " AT (16,11) " The Terminal-server lets you work from outside the Oslo " AT (17,11) " office without having the programs installed on the PC. " AT (18,11) " The Shipnet-server stores all of the post-fixtures. " AT (20,11) "If you have any problems with any of the programs or your" AT (21,11) "PC, we at the IT-department will do our best to help you." AT (22,11) " You can reach us at 777 during working hours and at 888 " AT (23,11) " after working hours. From outside dial 22 52 78 88. " Color g/w+ AT (24,28) "Press a key to continue" do until kbhit() endif
;**** ;**** Testing for certain specific dates ;**** $array = @mdayno, @monthno $today = join($array, "/")
if $today = "1/1" $specialday = "Happy New Year!" endif
if $today = "1/5" $specialday = "" endif
if $today = "17/5" $specialday = "Gratulerer med dagen Norge!" endif
if $today = "24/12" $specialday = "Merry Christmas!" endif
if $today = "25/12" $specialday = "Merry Christmas!" endif
if $today = "31/1" $specialday = "" endif
;**** ; **** This next string is for testing ;**** ;if $today = "22/9" $specialday = "Some type of text" ;endif
if len($specialday) > 0 Small $length = len($specialday) $x1 = ((79 - $length) / 2) - 1 $x2 = 79 - $x1 Color b+/n Box (0,0,24,79,GRID) Color b/n Box (11,$x1+1,15,$x2+1,Å) Color g/w+ Box (10,$x1,14,$x2,FULL) Color n/w+ AT (12,$x1+2) $specialday sleep 3 endif
;**** ;**** Adjusting the clock to same as server ;**** SetTime "\\lorfile"
;**** ;**** Making a box that shows some data about ;**** his/her machine and the network ;**** $mhz = "" $mhz = $mhz + @mhz + "MHz" $diskspace = getdiskspace("c:\") $diskspace = int($diskspace/1000) if len($diskspace) > 3 $length = len($diskspace) - 3 $diskspace = left($diskspace, $length) + "." + right($diskspace,3) + "MB" else if len($diskspace) < 2 $diskspace = "Harddisk full!" else $diskspace = $diskspace + "MB" endif endif Small Color b+/n Box (0,0,24,79,GRID) Color b+/n Box (6,21,19,61,Å) Color g/w+ Box (5,20,18,60,FULL)
Color b/w+ AT ( 7,25) "Userid : " AT ( 8,25) "Full name : " AT ( 9,25) "Group : " AT (10,25) "Privilege : " AT (11,25) "Workstation : " AT (12,25) "CPU speed : " AT (13,25) "C-drive : " AT (14,25) "Domain : " AT (15,25) "Logon Server : " AT (16,25) "Current Time : "
Color n/w+ AT ( 7,40) @userid AT ( 8,40) @fullname AT ( 9,40) @primarygroup AT (10,40) @priv AT (11,40) @wksta AT (12,40) $mhz AT (13,40) $diskspace AT (14,40) @domain AT (15,40) @lserver AT (16,40) @time color w+/w+ ;AT (0,0) Sleep 5
;**** ;**** Deleting all nettwork drives and setting ;**** up new ones ;**** Use "*" /delete $f = "\\lorsql\visma" $g = "\\lorfile\programs" $h = "\\lorfile\software" $i = "\\lorfile\c$" $j = "\\lorfile\d$" $k = "\\lorfile\download" $l = "\\lorfile\drivers" $m = "\\lorfile\kixtart" $n = "\\lorfile\netlogon" $o = "\\lorfile\z" $s = "\\lorfile\shared" $u = "\\lorfile\@userid" $v = "\\lorfile\@primarygroup" $w = "\\lorfile\departments"
Use f: $f Use g: $g Use h: $h Use s: $s Use u: $u Use v: $v Use w: $w
;**** ;**** If you are a domain admin it also sets ;**** up a few more network drives ;**** :Domain_admins If InGroup ("Domain admins") Use i: $i Use j: $j Use k: $k Use l: $l Use m: $m Use n: $n Use o: $o EndIf
;**** ;**** Everyone in the Oslo office has access to ;**** these printers ;**** :Printers_for_OSLO If InGroup ("l_gr_all") AddPrinterConnection ("\\lorfile\admin") AddPrinterConnection ("\\lorfile\colorlaser") EndIf
;**** ;**** One group for each printer (default printer) ;**** Each person can only be in one group so ;**** additional printers must be defined here ;**** :Printers_for_IKT If InGroup ("p_gr_ikt") AddPrinterConnection ("\\lorfile\ikt") If SetDefaultPrinter ("\\lorfile\admin")=0 EndIf EndIf
:Printers_for_OPS If InGroup ("p_gr_ops1") AddPrinterConnection ("\\lorfile\ops1") If SetDefaultPrinter ("\\lorfile\ops1")=0 EndIf EndIf
If InGroup ("p_gr_ops2") AddPrinterConnection ("\\lorfile\ops2") If SetDefaultPrinter ("\\lorfile\ops2")=0 EndIf EndIf
If InGroup ("p_gr_ops3") AddPrinterConnection ("\\lorfile\ops3") If SetDefaultPrinter ("\\lorfile\ops3")=0 EndIf EndIf
If InGroup ("p_gr_ops4") AddPrinterConnection ("\\lorfile\ops4") If SetDefaultPrinter ("\\lorfile\ops4")=0 EndIf EndIf
:Printers_for_DRY If InGroup ("p_gr_dry1") AddPrinterConnection ("\\lorfile\dry1") If SetDefaultPrinter ("\\lorfile\dry1")=0 EndIf EndIf
If InGroup ("p_gr_dry2") AddPrinterConnection ("\\lorfile\dry2") If SetDefaultPrinter ("\\lorfile\dry2")=0 EndIf EndIf
If InGroup ("p_gr_dry3") AddPrinterConnection ("\\lorfile\dry3") If SetDefaultPrinter ("\\lorfile\dry3")=0 EndIf EndIf
If InGroup ("p_gr_dry4") AddPrinterConnection ("\\lorfile\dry4") If SetDefaultPrinter ("\\lorfile\dry4")=0 EndIf EndIf
:Printers_for_SandP If InGroup ("p_gr_sandp1") AddPrinterConnection ("\\lorfile\sandp1") If SetDefaultPrinter ("\\lorfile\sandp1")=0 EndIf EndIf
If InGroup ("p_gr_sandp2") AddPrinterConnection ("\\lorfile\sandp2") If SetDefaultPrinter ("\\lorfile\sandp2")=0 EndIf EndIf
:Printers_for_NBOff If InGroup ("p_gr_nboff") AddPrinterConnection ("\\lorfile\nboff") If SetDefaultPrinter ("\\lorfile\nboff")=0 EndIf EndIf
:Printers_for_TANK If InGroup ("p_gr_tank") AddPrinterConnection ("\\lorfile\tank") If SetDefaultPrinter ("\\lorfile\tank")=0 EndIf EndIf
:Printers_for_GAS If InGroup ("p_gr_gas") AddPrinterConnection ("\\lorfile\gas") If SetDefaultPrinter ("\\lorfile\gas")=0 EndIf EndIf
:Printers_for_ADMIN If InGroup ("p_gr_admin2") AddPrinterConnection ("\\lorfile\admin2") If SetDefaultPrinter ("\\lorfile\admin2")=0 EndIf EndIf
If InGroup ("p_gr_admin3") AddPrinterConnection ("\\lorfile\admin3") If SetDefaultPrinter ("\\lorfile\admin3")=0 EndIf EndIf
:Printers_for_ACCOUNT If InGroup ("p_gr_account") AddPrinterConnection ("\\lorfile\account") If SetDefaultPrinter ("\\lorfile\account")=0 EndIf EndIf
:Printers_for_RESEARCH If InGroup ("p_gr_research") AddPrinterConnection ("\\lorfile\research") If SetDefaultPrinter ("\\lorfile\research")=0 EndIf EndIf
;**** ;**** Copying necessary files for Symantec Live Update ;**** And setting necessary registry key ;**** Copy "%0\..\liveupdt.hst" "c:\program files\symantec\liveupdate\" Copy "%0\..\s32luhl1.dll" "c:\program files\symantec\liveupdate\" WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\LiveUpdate\Preferences","All Transports Available","0","REG_DWORD")
;**** ;**** Checking if screensaver is active ;**** If not, new screensaver is set ;**** $dir = ReadValue("HKEY_LOCAL_MACHINE\software\microsoft\windows NT\currentversion", "SystemRoot") Copy "%0\..\ls.bmp" $dir $scrsvr = $dir + "\ls.bmp" WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveActive","1","REG_SZ") WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveTimeOut","600","REG_SZ") WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","SCRNSAVE.EXE",$dir + "\system32\ss3dfo.SCR","REG_SZ") WriteValue("HKEY_CURRENT_USER\Control Panel\Screen Saver.3DFlyingObj","Texture",$scrsvr,"REG_SZ") WriteValue("HKEY_CURRENT_USER\Control Panel\Screen Saver.3DFlyingObj","Size","100","REG_SZ") WriteValue("HKEY_CURRENT_USER\Control Panel\Screen Saver.3DFlyingObj","Tesselation","200","REG_SZ") WriteValue("HKEY_CURRENT_USER\Control Panel\Screen Saver.3DFlyingObj","Type","6","REG_SZ")
;**** ;**** Checking if the homepage on IE is our official ;**** If not, http://www.lorstem.com is set ;**** :IE_Start_Page $home=ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main","Start Page") If $home<>"http://www.lorstem.com" Goto Set_Home_Page Else Goto end EndIf :Set_Home_Page WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main","Start Page","http://www.lorstem.com","REG_SZ")
;**** ;**** Flushing all keystrokes ;**** flushkb
:END Exit
|
|
Re: Copying files
|
|
Try creating a batch file (plain, old, batch file!) with a single COPY line to perform the same thing and assign that as the logon script. (Maybe with a net use before to set N:?) Run it and let us know...
|
Sverre
|
(Getting the hang of it)
|
2002-09-29 05:43 PM
|
|
|
|
|
Re: Copying files
|
|
Works like a dream, but it's kind of cheating.
code:
@echo off copy %0\..\ls.bmp %windir% > null kix32 login.kix
|
|
Re: Copying files
|
|
Sometimes, the best solutions are not the "pretiest" ones... Besides, now you have a working solution so you can shift your focus elsewhere. Someday, when you're less stressed, maybe it'll "hit" you and you'll get back to this. Also, did you check LLigetfa's and Lonkero's sugestions about the "%0" ?
|
Les
|
(KiX Master)
|
2002-09-29 05:50 PM
|
|
|
|
|
Re: Copying files
|
|
I don't think you understand the %0\..% thingy. Try the following two examples and maybe it'll enlighten.
First a batch file test.bat code:
echo %0\..% this is what you get in a batch file kix32 test.txt exit
Then a Kix script test.txt code:
break on "%0\.." + ' <= This is what "%0\.." gives you in KiX' ? "%0\..%" + ' <= This is what %"' + '0\..%" gives you in KiX' ? ExpandEnvironmentVars("%0\..%") + ' <= This is what ExpandEnvironmentVars(%"' + '"0\..%) gives you in KiX' ? "%0\..\ls.bmp" + ' <= This is what %"' + '0\..\ls.bmp" gives you in KiX' ? get $
[ 29. September 2002, 17:50: Message edited by: LLigetfa ]
|
Sverre
|
(Getting the hang of it)
|
2002-09-29 05:51 PM
|
|
|
|
|
Re: Copying files
|
|
Didn't check the %0 since it works a few lines above.
|
Les
|
(KiX Master)
|
2002-09-29 06:08 PM
|
|
|
|
|
Re: Copying files
|
|
So, do you understand why it supposedly works on one line and not the other?
I certainly would not use code that I don't understand. When you adopt code you don't understand, it has a way of turning and biting you.
|
Sverre
|
(Getting the hang of it)
|
2002-09-29 06:15 PM
|
|
|
|
|
Re: Copying files
|
|
Well, I wouldn't say I don't understand it. On the other hand, most of us don't know what most functions we use in programming really does. I mean, we understand what it returns, but do we understand exactly what it does to bring us the result? I haven't programmed in assembler since my days at college and that was in the late 70s heheh.
What I asked the scrit to do in this case was to copy a file from the netlogon folder of the "active" domain controller and put it in the directory where the operating system was installed. Not sure if anyone can ask me to understand more than that.
|
Lonkero
|
(KiX Master Guru)
|
2002-09-29 06:51 PM
|
|
|
|
|
Re: Copying files
|
|
netlogon...
so @ldrive+"\file" is the actual...
anyway, what comes to assembler, it's hard way to go as there is no api's in assembler and don't know if even ruud understands fully what is behind all of those...
anyway, withing kixtart yoou can't see the %1 and so forth and I don't think that you can see %0 either.
so, my quess is that you use it in shell/run call. and then it works. but directly in kix it shouldn't.
what is the command before where it works?
{edit} checked on that... are you sure it works? as it might be there already...   [ 29. September 2002, 18:53: Message edited by: Lonkero ]
|
Les
|
(KiX Master)
|
2002-09-29 07:05 PM
|
|
|
|
|
Re: Copying files
|
|
Well, I'll be the first to admit that I don't understand how (why?) it works further up in the script. Don't understand the connection to assembler either... particularly since KiX isn't written in assembly. What comes to assembly, at least there, every line is fully understandable. With APIs, there's a lot hidden under the covers.
My memory of assember is more recent (early 80s) but still does not enlighten.
The reason I say it may turn and bite is that XP has changed the behaviour of %0.
|
Lonkero
|
(KiX Master Guru)
|
2002-09-29 07:14 PM
|
|
|
|
|
Re: Copying files
|
|
I have a dream.
I dream of ability to create a kix-compiler but don't which way to go... quess the assembler anyway isn't the way to go.
well, I'll keep the dream alive and maybe at some point it will come true.  
|
kholm
|
(Korg Regular)
|
2002-09-29 10:46 PM
|
|
|
|
|
Re: Copying files
|
|
You want to copy from the NetLonon share, to a local file !
There has been some issues on the "%0\..\" on WinXP posted on this board. Furthermore, %0 is a batchfile parameter, you can replace this in a KiX-script.
Instead of this: Copy "%0\..\ls.bmp" $dir
Try using: Copy "@LServer\Netlogon\ls.bmp" $dir
-Erik
|
Lonkero
|
(KiX Master Guru)
|
2002-09-29 10:58 PM
|
|
|
|
|
Re: Copying files
|
|
erik, isn't: Copy "@LServer\Netlogon\ls.bmp" $dir
just the same as: Copy "@ldrive\ls.bmp" $dir
|
|
Re: Copying files
|
|
You need to have administrative rights in order to copy files into most of the WINNT (sub-)directories. Also, I would alwasy specify the complete file for both he copy-from and the copy-to and do an EXIST beforehand to make sure the file actually exists.Thus:
code:
$copyfrom='\\server\share\fiel.txt' $copyto='%WINNT%' if exist($copyfrom) if exist($copyto) copy $copyfrom $copyto if @ERROR ? 'Error copying file: '+@ERROR+' - '+@SERROR endif else ? 'Cannot find folder '+$copyto endif else ? 'Cannot find file '+$copyfrom endif
I know it it some mmore code to just copy a file but it'll help tremendously in troubleshooting if it doesn't work.
|