Page 1 of 1 1
Topic Options
#63686 - 2002-03-08 01:02 AM Shell vs. Run command
WeakLink Offline
Fresh Scripter

Registered: 2002-03-06
Posts: 37
Loc: San Diego
I noticed that the popular command used is "shell" to either run or install a program, however there were a few instances that "run" was used for installing programs. Is there a difference? I would use the command to launch an executable that would then launch a silent install.

Thx for your help.

Top
#63687 - 2002-03-08 01:24 AM Re: Shell vs. Run command
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Weaklink -
Difference is if you select RUN, the KiX script will continue processing while the program called via RUN also executes. If you select SHELL, the KiX script stops until the program called via SHELL terminates. So, using one over another depends upon what you are trying to do.

Bill

Top
#63688 - 2002-03-08 01:47 AM Re: Shell vs. Run command
WeakLink Offline
Fresh Scripter

Registered: 2002-03-06
Posts: 37
Loc: San Diego
Bill,

Thank you for your response. Would you mind taking a look at what I am trying to do? I posted this earlier but haven't gotten a reply yet.

code:
 

I have this script that I'm trying to use to run a silent install of Lotus Notes. With WIN98 I receive an msg stating "out of evironment space", but with NT and W2K I don't receive an error msg, it just doesn't install. I tested silent install w/o scripts, and it works just fine, so it must be the script.

Here's the bat that calls the script:

:START
IF EXIST "x:\nodomain.script" goto END
IF "%OS%"=="Windows_NT" GOTO WINNT
IF "%OS%"=="W2K" GOTO WINNT
IF "%OS%"=="XP" GOTO WINNT

:WIN9X
SET KIXDIR=%WINDIR%\KIX
SET KIXSCRIPT=\\test01dc\netlogon\notes.kix
SET KIXVER=KIX362
GOTO COPY

:COPY
IF NOT EXIST %KIXDIR%\NUL MKDIR %KIXDIR%
IF EXIST %KIXDIR%\%KIXVER% GOTO KIXCOPIED
COPY %0\..\KIX32.EXE %KIXDIR% /Y >NUL
COPY %0\..\KX16.DLL %KIXDIR% /Y >NUL
COPY %0\..\KX32.DLL %KIXDIR% /Y >NUL
COPY %0\..\KX95.DLL %KIXDIR% /Y >NUL
:: ECHO. >%KIXDIR%\%KIXVER%

:KIXCOPIED
IF NOT EXIST %KIXDIR%\KIX32.EXE COPY %0\..\KIX32.EXE %KIXDIR% >NUL
IF NOT EXIST %KIXDIR%\KX16.DLL COPY %0\..\KX16.DLL %KIXDIR% >NUL
IF NOT EXIST %KIXDIR%\KX32.DLL COPY %0\..\KX32.DLL %KIXDIR% >NUL
IF NOT EXIST %KIXDIR%\KX95.DLL COPY %0\..\KX95.DLL %KIXDIR% >NUL
GOTO LOGON

IF NOT EXIST %0 GOTO NOEXT
%KIXDIR%\KIX32.EXE %0 $kixscript="%KIXDIR%\KIX32.EXE %KIXSCRIPT%"
GOTO LOGON

:LOGON
\\test01dc\netlogon\KIX32.EXE %kixscript%
GOTO END

:NOEXT
%KIXDIR%\KIX32.EXE %0.BAT $kixscript="%KIXDIR%\KIX32.EXE %KIXSCRIPT%"
GOTO END

:WINNT
\\test01dc\netlogon\KIX32.EXE \\test01dc\netlogon\notes.kix

:END

Here's the kix script:

; Unattended Check and install of Lotus Notes
If SetConsole("hide")
EndIf

;-----------------------------------------------------------------------------------------------
;PC Inventory Script to gather basic user, software and system data, redirects to \\TEST01DC\Common\noteslog
;-----------------------------------------------------------------------------------------------

; Tag Script Start Time and date
$StartTime = @TIME

; ------------- Redirect output ----------------
If RedirectOutput("\\test01dc\Common\noteslog\@wksta.log", 1) = 0
? "Opened '@wksta.log' at " + @TIME ?
EndIf


; ----------- Get Available (Free) Diskspace on C: -------------
$DiskSpace = GetDiskSpace("C:\")

; ----------- Determine CPU Speed ------------------
$mhz=ReadValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","~MHz")

; ----------- Determine Drive Mappings --------------
Use list
If @ERROR=0
WriteLine(1, "[Connections]")
While $X<>"End of list."
$X=ReadLine(2)
WriteLine(1, $X)
Loop
; ------------ Display Variables and redirect to @wksta.@domain.log -------------
:write
? "--------------------------------------------"
? "System Information"
? "--------------------------------------------"
? "DOMAIN = " @DOMAIN
? "LOGON_SERVER = " @LSERVER
? "WORKSTATION = " @WKSTA
? "USERID = " @USERID
? "FULLNAME = " @FULLNAME
? "PRIVILIDGE = " @PRIV
? "IPADDRESS = " @IPADDRESS0
? "MAC_ADDRESS = " @ADDRESS
? "LOCATION = " $LOCATION
? "OS_VERSION = " $os
? "CPU_SPEED(MHz) = " $mhz
? "FREE_C:\(Bytes) = " $DiskSpace
? "KIX_VERSION = " @KIX
? "KIX_Directory = " @STARTDIR
? "DRIVE_MAPPING = " $X
? "LAST_LOGIN = " @DATE " " @TIME
? ""
;------------ Check to see if Notes is already installed --------------
$Notes="\Lotus\Notes\notes.exe"

If EXIST ($Notes)
Goto End
If $DiskSpace <= 500000
Goto End

Else
MessageBox("Lotus Notes is currently being installed on your PC. There is no user intervention required, please allow 8 minutes for completion.")
Shell '%COMSPEC% \\test02dc\notes\drivec.exe'
EndIf

:End

Any help you can give will be much appreciated.

Thx in advance.


Top
#63689 - 2002-03-08 03:22 PM Re: Shell vs. Run command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Modify your shell command to 'SHELL %COMSPEC% /E:1024 /C' or use the following UDF: http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=12;t=000057

[ 08 March 2002, 15:22: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#63690 - 2002-03-08 03:42 PM Re: Shell vs. Run command
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I suspect you may be consuming the environment space in your BAT file that calls KiX. Try eliminating the SET statements and hard code.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63691 - 2002-03-08 05:29 PM Re: Shell vs. Run command
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Weaklink -
A few questions/observations/suggestions:

1. Are you sure the Windows variable %OS% returns values of 'W2K' and 'XP'? On my Windows 2000 system the value is 'Windows_NT'.

2. Here at the top of section :WIN9X:
SET KIXVER=KIX362
GOTO COPY
goto appears unnecessary as next line is the copy section.

3. Your KiX exe and dll copy portion will not overwrite older/invalid files, simply confirm some files exist. To script upgrading component to 3.63/4.02, I would add something like:
code:
IF EXIST %KIXDIR%\KIX32.EXE		DEL %KIXDIR%\KIX32.EXE
IF EXIST %KIXDIR%\KX16.DLL DEL %KIXDIR%\KX16.DLL
IF EXIST %KIXDIR%\KX32.DLL DEL %KIXDIR%\KX32.DLL
IF EXIST %KIXDIR%\KX95.DLL DEL %KIXDIR%\KX95.DLL
IF EXIST %KIXDIR%\System\KIX32.EXE DEL %KIXDIR%\System\KIX32.EXE
IF EXIST %KIXDIR%\System\KX16.DLL DEL %KIXDIR%\System\KX16.DLL
IF EXIST %KIXDIR%\System\KX32.DLL DEL %KIXDIR%\System\KX32.DLL
IF EXIST %KIXDIR%\System\KX95.DLL DEL %KIXDIR%\System\KX95.DLL

prior to copying the files in place.

4. To reduce inuse %Kix...% variables, use "SET VarName=" to clear them prior to launching the KiX script. You could reduce reliance upon variables by simply putting KIX files in %windir%, or %windir%\system instead of creating a special directory to hold 4 files.

5. It appears once you hit the section COPY, you will also execute the section KIXCOPIED, as there is no additional GOTO to bypass.

6. This section of batch file:
IF NOT EXIST %0 GOTO NOEXT
%KIXDIR%\KIX32.EXE %0 $kixscript="%KIXDIR%\KIX32.EXE %KIXSCRIPT%"
appears unreachable since you 'GOTO LOGON' directly above.

7. Recommend you change the LOGON to call KIX32 from the client versus network to improve performance. Why spend all the effort to maintain accurate files on the client if you are not expecting to use them except when server unavailable?

Bill

Top
#63692 - 2002-03-08 05:48 PM Re: Shell vs. Run command
WeakLink Offline
Fresh Scripter

Registered: 2002-03-06
Posts: 37
Loc: San Diego
Bill,

Thanks for your reply. As a matter of fact, I am not sure that the variable %OS% returns value of "W2K'. I had no idea what the value was, I just tried to see if it would work. You wouldn't know what the value is for XP would you? Thanks for your suggestions, and I will try them right now. I appreciate all of your help, since I'm a newbie and can use all the help I can get!

Top
#63693 - 2002-03-08 05:54 PM Re: Shell vs. Run command
WeakLink Offline
Fresh Scripter

Registered: 2002-03-06
Posts: 37
Loc: San Diego
Bill,

You also bring up another point that I need help with. I really don't want to copy the files locally onto the workstation, because we have a host of developers that claim that their code is wrecked whenever ANY file is copied to their PC. So, even though I know that kix files won't hurt a PC or applications, I prefer not to battle these developers and run the files from the server. If I exclude the copy statements, will this cause a problem?

Bill wrote:
5. It appears once you hit the section COPY, you will also execute the section KIXCOPIED, as there is no additional GOTO to bypass.

6. This section of batch file:
IF NOT EXIST %0 GOTO NOEXT
%KIXDIR%\KIX32.EXE %0 $kixscript="%KIXDIR%\KIX32.EXE %KIXSCRIPT%"
appears unreachable since you 'GOTO LOGON' directly above.

7. Recommend you change the LOGON to call KIX32 from the client versus network to improve performance. Why spend all the effort to maintain accurate files on the client if you are not expecting to use them except when server unavailable?

Top
#63694 - 2002-03-08 06:57 PM Re: Shell vs. Run command
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
It's only the Wintendos that benefit from local copies. NT/2K/XP has no problem running from a share.
For Wintendos, I think %windir% is the best place for the exes and dlls.
I can't imagine that developers would be on Wintendo.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63695 - 2002-03-08 07:01 PM Re: Shell vs. Run command
WeakLink Offline
Fresh Scripter

Registered: 2002-03-06
Posts: 37
Loc: San Diego
I get now it, Les. And yes, you are right, none of the developers are running under NT. ; - )
Top
#63696 - 2002-03-08 07:14 PM Re: Shell vs. Run command
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Weaklink -
I believe XP also returns 'Windows_NT'. As for running across the network, sure, it's fine for NT-class. However, I would recommend you structure your script to run from any DC via the netlogon share, versus a single server. If the one server is off line no users will run your script. This variable is %logonserver% for NT/2K systems. Since XP essentially 2K from networking perspective, should be same for it as well.
Bill

Top
#63697 - 2002-03-08 07:48 PM Re: Shell vs. Run command
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Weaklink,

Please take a look at this post for more ideas on batch file calls.

There is also a batch file that can determine between all the different Win32 OS platforms.

Kix does not works on some machines

You can also set variables or flag files, or read files, or set registry entries, etc... to exclude certain users, and or machines from running KiX, or based upon group membership, etc... only run certain SUB scripts depending on group. Many, many ways to control the execution of KiX.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 581 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.066 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