Page 1 of 1 1
Topic Options
#131662 - 2004-12-21 11:44 AM Copy /s ? won'twork?
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
#131663 - 2004-12-21 11:52 AM Re: Copy /s ? won'twork?
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Hi,

Your syntax is incorrect please refer to the manual or check out this link

Copy

Aaron
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#131664 - 2004-12-21 12:13 PM Re: Copy /s ? won'twork?
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
#131665 - 2004-12-21 12:34 PM Re: Copy /s ? won'twork?
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Have you tried any error reporting, did that return any values?
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#131666 - 2004-12-21 01:30 PM Re: Copy /s ? won'twork?
Richie19Rich77 Offline
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
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 Offline
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
Unregistered


I looked at this in the manual but does /r work?? It says read only files??
Top
#131670 - 2004-12-21 05:00 PM Re: Copy /s ? won'twork?
Richie19Rich77 Offline
Seasoned Scripter
*****

Registered: 2002-08-16
Posts: 624
Loc: London, England
Yeah it works fine if your using 4.22 or above.

But looking at your script, is the user running this on login ??, if so they must have admin rights or it is not going to work. !!

The @inwin = 1 is a Windows NT or 2000, and the location you are trying to copy to is Read Only access for Domain Users, unless you have modified the permissions.

C:\, C:\Documents and Settings\All Users\Desktop and C:\Program Files.



Edited by Richie19Rich77 (2004-12-21 05:04 PM)

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
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.056 seconds in which 0.024 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