Page 1 of 1 1
Topic Options
#124385 - 2004-08-04 11:26 AM Call batch file
Anonymous
Unregistered


Hi guys I am from a Netware environment so this stuff is relatively new to me.
What is the best way to call a batch file in Kix based on a group as user belongs to.

Previously in netware is used the:

if member of group "test"
@z:\test\test.bat
end if

Is the syntax the same???

Top
#124386 - 2004-08-04 11:36 AM Re: Call batch file
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
nope ... @ is a special character in KiXtart denoting a macro

your command shall be SHELL.
Brrowing from the manual :

Quote:

Shell

Action: Loads and runs a program.

Syntax: SHELL "command"

Remarks: Command can be any 16-bit or 32-bit application. To run command interpreter commands, specify the correct command interpreter as part of the command.
Script execution is stopped until the program exits.

If the program you want to run needs to set environment variables (as is the case with Smsls.bat, for example), you may need to specify additional environment space by using the /E parameter.

SHELL sets the value of @ERROR to the exit code of the program that is run.

See Also: Run

Examples: SHELL @LDRIVE + "\UPDATE.EXE"
SHELL "%COMSPEC% /e:1024 /c DIR C:"
SHELL "SETW USERNAME=@USERID"
SHELL "CMD.EXE /C COPY " + @LDRIVE + "\FILE.TXT C:\"
SHELL "%COMSPEC% /C COPY Z:\FILE.TXT C:\"
SHELL "C:\WINNT\SYSTEM32\CMD /E:1024 /C " + @LDRIVE + "\SMSLS.BAT"






Even better is to convert/rewrite/include the batch parts directly into your Kixscript, but that might be a lesson for another day.

Maybe you get one of us to do it for ya if you post the batch(es) here
_________________________



Top
#124387 - 2004-08-04 11:43 AM Re: Call batch file
Anonymous
Unregistered


Hi many thanks for you offer.

I think what I require is a simple batch. The folder resides on drive t:\. The folder is entitled AntiV and the batch file is entitled AntiV.bat. The group is named nw2_AV.
Is this all you need?
Thanks

Top
#124388 - 2004-08-04 11:47 AM Re: Call batch file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ja, simply adding the group code into the kix is lot easier (and faster) than shelling out.

if ingroup("this and that")
;do group code
endif
_________________________
!

download KiXnet

Top
#124389 - 2004-08-04 11:56 AM Re: Call batch file
Anonymous
Unregistered


Lonkero,

Your text:

if ingroup("this and that")
;do group code
endif

Using the data I have provided how would I replace your text with my requirments listed above??? I am working off a 56k modem which s struggling to download the manual? Thanks

Top
#124390 - 2004-08-04 12:02 PM Re: Call batch file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
shell "%comspec% /c mypath\mybatch.bat"

does the shelling like you did in your original post.
_________________________
!

download KiXnet

Top
#124391 - 2004-08-04 12:03 PM Re: Call batch file
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
are you asking how to convert:

if member of group "test"
@z:\test\test.bat
end if

to:
if ingroup("this and that")
;do group code
endif


come on now...

if ingroup("test")
shell 'z:\test\test.bat'
endif
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#124392 - 2004-08-04 02:06 PM Re: Call batch file
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Keep in mind that Z: is used during login for W9x/Wme..

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#124393 - 2004-08-04 02:44 PM Re: Call batch file
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
And you may just want to convert the code into KiXtart. There is very little you can do in batch scripting that you can't do in KiX. KiX is much more flexible and powerful.
Top
#124394 - 2004-08-04 02:59 PM Re: Call batch file
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
slow down chris... one step at a time...
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#124395 - 2004-08-04 03:05 PM Re: Call batch file
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

I am working off a 56k modem which s struggling to download the manual?



I don't understand. KiX ships with the manual so how is it you have KiX and no manual?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124396 - 2004-08-04 03:07 PM Re: Call batch file
Anonymous
Unregistered


Thanks for all you help guys.

I have now created the script and it appears to work fine. I have a quesiton about Kix though. Within the batch file the code is as follows:

@echo off
if exist c:\EPOAgent\history.txt goto end
if not exist c:\epoagent\history.txt goto install
pause

:install
copy t:\AntiV\sdat4382.txt c:\
del c:\sdat*.exe
type t:\AntiV\NW2_AVcopying.txt
copy t:\AntiV\sdat4382.xex c:\sdat4382.xex
ren c:\sdat4382.xex sdat4382.exe
@c:\sdat4382.exe /silent /f
type t:\AntoV\NW2_AVcompleted.txt
exit

:end
exit

I have a problem in that the script does not recognise the file on the first line and go to end (exit).
Am I doing something wrong or is there something differnet in Kix? The file exists on the machine but the script does not recognise it?
Thanks

Top
#124397 - 2004-08-04 03:11 PM Re: Call batch file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
how do you call it?
_________________________
!

download KiXnet

Top
#124398 - 2004-08-04 03:15 PM Re: Call batch file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and why you don't just put it in kix-script?
Code:

if ingroup("test")
if not exist("c:\epoagent\history.txt")
copy "t:\AntiV\sdat4382.txt" "c:\"
del "c:\sdat*.exe"
display "t:\AntiV\NW2_AVcopying.txt"
copy "t:\AntiV\sdat4382.xex" "c:\sdat4382.exe"
shell "c:\sdat4382.exe /silent /f"
display "t:\AntoV\NW2_AVcompleted.txt"
endif
endif

_________________________
!

download KiXnet

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
0 registered and 987 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.067 seconds in which 0.026 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