#131662 - 2004-12-21 11:44 AM
Copy /s ? won'twork?
|
Anonymous
Anonymous
Unregistered
|
I have this piece of basic code. I cannot understand why it won't work? Can someone please help?
;Check users desktop for CIS install
if ingroup("nw2_CISinstall")
if exist ("c:\CISinst.txt") quit 1 endif
if @inwin = 1 if not exist ("c:\CISinst.txt") copy "S:\CIS\CISInst.txt" "C:\" copy "S:\CIS\Desktop\ /s" "C:\Documents and Settings\All Users\Desktop\" copy "S:\CIS\Applic\ /s" "C:\Program Files\" endif endif
if @inwin = 2 if not exist ("c:\CIS_Inst.txt") copy "S:\CIS\CISInst.txt" "C:\" copy "S:\CIS\Desktop\ /s" "C:\Windows\Desktop\" copy "S:\CIS\Applic\ /s" "C:\Program Files\" endif endif
endif ;---------------------------------------------------------------------------------------
|
|
Top
|
|
|
|
#131664 - 2004-12-21 12:13 PM
Re: Copy /s ? won'twork?
|
Anonymous
Anonymous
Unregistered
|
I have changed the syntax, thought I was correct? But still does not work? Can you see why?
;Check users desktop for CIS install
if ingroup("nw2_CISinstall")
if exist ("c:\CISinst.txt") quit 1 endif
if @inwin = 1 if not exist ("c:\CISinst.txt") copy "S:\CIS\CISInst.txt" "C:\" copy "S:\CIS\Desktop\*.*" "C:\Documents and Settings\All Users\Desktop" /s copy "S:\CIS\Applic\*.*" "C:\Program Files" /s endif endif
if @inwin = 2 if not exist ("c:\CIS_Inst.txt") copy "S:\CIS\CISInst.txt" "C:\" copy "S:\CIS\Desktop\*.*" "C:\Windows\Desktop" /s copy "S:\CIS\Applic\*.*" "C:\Program Files" /s endif endif
endif ;---------------------------------------------------------------------------------------
|
|
Top
|
|
|
|
#131666 - 2004-12-21 01:30 PM
Re: Copy /s ? won'twork?
|
Richie19Rich77
Seasoned Scripter
   
Registered: 2002-08-16
Posts: 624
Loc: London, England
|
Optimize your code like this:
Code:
;Check users desktop for CIS install
if ingroup("nw2_CISinstall") if NOT exist("c:\CISinst.txt") Select Case @inwin = 1 copy "S:\CIS\CISInst.txt" "C:\" copy "S:\CIS\Desktop\*.*" "C:\Documents and Settings\All Users\Desktop" /s copy "S:\CIS\Applic\*.*" "C:\Program Files" /s Case @inwin = 2 copy "S:\CIS\CISInst.txt" "C:\" copy "S:\CIS\Desktop\*.*" "C:\Windows\Desktop" /s copy "S:\CIS\Applic\*.*" "C:\Program Files" /s
EndSelect Endif Endif
|
|
Top
|
|
|
|
#131667 - 2004-12-21 04:03 PM
Re: Copy /s ? won'twork?
|
Anonymous
Anonymous
Unregistered
|
To overwrite any existing files do you use the /r command or is this a feature that is not available with the copy command?
|
|
Top
|
|
|
|
#131668 - 2004-12-21 04:29 PM
Re: Copy /s ? won'twork?
|
Richie19Rich77
Seasoned Scripter
   
Registered: 2002-08-16
Posts: 624
Loc: London, England
|
/c and /r arguments were added with the release of v4.22.
Quote:
Syntax
Copy "<source>" "<destination>" [<filename>] [/h] [/s][/c][/r]
Parameters
source = source path and file of file or directory to be moved/renamed
destination = target path and file name for new copy of source
filename = optional file name for target (allows rename)
/h = include hidden files (optional)
/s = include subdirectories(optional)
/c = Continue if errors occur
/r = Overwrite read-only files
Description
Creates a copy of one or more files
Return Values
KiXtart commands return a Win32 error code:
0 = The operation completed successfully
2 = The system cannot find the file specified.
3 = The system cannot find the path specified.
Enter "net helpmsg [number]" at the command prompt to learn the meaning of any Win32 error code, where [number] represents the error you are being returned.
Example
Copy "\\production\data\critical\*.*" "\\backups\critical"
Remarks
The Copy command allows you to copy files from one location to another. When copying an individual file, you may specify an alternate name for the copy by specifying an optional destination file name. When specifying a directory path, a trailing backslash is not necessary; if included, it will be ignored.
The KiXtart Copy command does not copy files with the "system" file attribute.
When determining if the specified destination (target) is a file or a directory, a file will be assumed if no directory of that name exists. If copying multiple files, you must specify an existing directory as a target to receive the files.
/c and /r arguments were added with the release of v4.22.
|
|
Top
|
|
|
|
#131669 - 2004-12-21 04:33 PM
Re: Copy /s ? won'twork?
|
Anonymous
Anonymous
Unregistered
|
I looked at this in the manual but does /r work?? It says read only files??
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|