#62779 - 2002-02-04 07:23 PM
IF Statement
|
Phil Q
Fresh Scripter
Registered: 2002-02-04
Posts: 18
Loc: UK
|
I have written this script to check if OS is Win 9x and copy a file to a specified location and if not copy the file to another location. This does not work so please let me as I am new to Kixstat. ==use s: ("\\triton.part\shared") use u: ("\\triton.part\users") use Z: ("\\Avmanage\programs")IF EXIST c:\windows copy z:\lmhost c:\windows else copy z:\lmhost c:\winnt\system32\drivers\etc ENDIF Thanks 
|
|
Top
|
|
|
|
#62781 - 2002-02-04 07:35 PM
Re: IF Statement
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Phil Q,Welcome to the board.. Have you looked into the following macros: quote:
@INWIN Operating system: 1 = Windows NT; 2 = Windows 9x
Or... quote:
@DOS Version of Windows NT
Thanks! - Kent
|
|
Top
|
|
|
|
#62782 - 2002-02-04 07:56 PM
Re: IF Statement
|
Phil Q
Fresh Scripter
Registered: 2002-02-04
Posts: 18
Loc: UK
|
Lonkero The script is not giving me any errors but the file is not being copied. Any ideas?Thanks anyway...
|
|
Top
|
|
|
|
#62783 - 2002-02-04 08:08 PM
Re: IF Statement
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
phil, can't see why you don't get errors. the syntax is wrong so it should give one. anyway, you can't copy directories with kix-copy. here is what it does: quote: COPY Action Copies one or more files. Syntax COPY "source" "destination" [/h] Remarks Wildcards are supported. If a file already exists at the destination, it is overwritten without warning. The /h option can be used to include files with the hidden or system attribute set in the copy.
so to copy all files in the directory try this one:
code:
IF EXIST("c:\windows") copy "z:\lmhost\*.*" "c:\windows\" /h else copy "z:\lmhost\*.*" "c:\winnt\system32\drivers\etc\" /h ENDIF
kdyer pointed out good issue. if you are checking c:\windows it may not be allways right. nt-machines can also have c:\windows as root directory. %windir% is the place where windows resides. to check different os inwin is good one. so you might also want to try this one:
code:
IF "@inwin"="2" copy "z:\lmhost\*.*" "%windir%" /h else copy "z:\lmhost\*.*" "%windir%\system32\drivers\etc\" /h ENDIF
cheers,
_________________________
!download KiXnet
|
|
Top
|
|
|
|
#62785 - 2002-02-04 08:27 PM
Re: IF Statement
|
Phil Q
Fresh Scripter
Registered: 2002-02-04
Posts: 18
Loc: UK
|
Thanks. I will try that and let you know the outcome
|
|
Top
|
|
|
|
#62788 - 2002-02-07 01:54 AM
Re: IF Statement
|
Syserco Administrator
Lurker
Registered: 2002-02-07
Posts: 4
Loc: Fremont
|
The latest version of Kixtart also has the @PRODUCTTYPE macro which can be used like:-------------Code------------ IF @PRODUCTTYPE="Windows 98" USE U: @HOMEDIR ELSE GOTO "QUIT" :QUIT QUIT ------------ENDCode---------- Regards, Alex
|
|
Top
|
|
|
|
#62789 - 2002-02-07 04:12 PM
Re: IF Statement
|
Phil Q
Fresh Scripter
Registered: 2002-02-04
Posts: 18
Loc: UK
|
Thanks it worked
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 661 anonymous users online.
|
|
|