#63686 - 2002-03-08 01:02 AM
Shell vs. Run command
|
WeakLink
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
|
|
|
|
#63688 - 2002-03-08 01:47 AM
Re: Shell vs. Run command
|
WeakLink
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
|
|
|
|
#63691 - 2002-03-08 05:29 PM
Re: Shell vs. Run command
|
bleonard
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
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
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
|
|
|
|
#63695 - 2002-03-08 07:01 PM
Re: Shell vs. Run command
|
WeakLink
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
|
|
|
|
#63697 - 2002-03-08 07:48 PM
Re: Shell vs. Run command
|
NTDOC
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
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 641 anonymous users online.
|
|
|