Re: scripting vs. batch files?



From: "Linn Kubler" <lkubler@xxxxxxxxxxxxxxxxxx>

| Hi,
|
| I've been using batch files for ages, nothing too complex but useful. I was
| just trying to figure out how, in my logon batch file, I could detect if a
| client was Windows 2000 or Windows XP. One of the solutions suggested is in
| the form of a VB script. So that made me wonder...
|
| Can you incorporate scripting syntax in a batch file or should I stop using
| batch files for logon scripts or what? Just how do you decide when to use
| scripting and when to use batch files?
|
| I'm browsing through the scripting center right now and am also wondering
| the best way to learn scripting... are there any good books on the subject,
| or which are the best books? Or, is it just as easy to work through the
| examples in the scripting center?
|
| Any thoughts?
|
| Thanks in advance,
| Linn
|
| P.S. Remove the "2" from my domain name for email responses.
|

The following Kixtart { http://kixtart.org Kixtart is CareWare } script snippet can
determine the OS by querying the Registry...

if (readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion","CurrentVersion")="4.0")=1
$OS="WINNT4"
endif
if (readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion","CurrentVersion")="5.0")=1
$OS="Windows 2000"
endif
if (readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion","CurrentVersion")="5.1")=1
$OS="Windows XP"
endif
if (readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion","CurrentVersion")="5.2")=1
$OS="Windows 2003 Server"
endif

Using a scripting language far ouweighs BAT and CMD scripts as you can do much more. There
are even macros in Kixtart to directly determine the OS without querying the Registry. For
one you can peek and poke the Registry. Another is you can use Windows Management
Instrumentation constructs.

--
Dave
http://www.claymania.com/removal-trojan-adware.html
http://www.ik-cs.com/got-a-virus.htm


.



Relevant Pages

  • Re: scripting vs. batch files?
    ... >| I've been using batch files for ages, ... >| client was Windows 2000 or Windows XP. ... >| Can you incorporate scripting syntax in a batch file or should I stop using ...
    (microsoft.public.windows.server.scripting)
  • Re: Is vbscript appropriate tool?
    ... contrast of using vbscript versus batch files for tasks such as the ... actual scripting examples for just about all the basic functions. ...
    (microsoft.public.scripting.vbscript)
  • Re: Network Timeout in Script
    ... > scripting, more batch files. ... The client machine list is editable and pulled from ... > Is there anyway I can change this default timeout for network connections to ...
    (microsoft.public.windows.server.scripting)
  • Re: scripting vs. batch files?
    ... Linn ... > I've been using batch files for ages, ... > Can you incorporate scripting syntax in a batch file or should I stop ... or which are the best books? ...
    (microsoft.public.windows.server.scripting)
  • RE: Logon Script
    ... I'm not a scripting guru so this is what I use in a batch file. ... ifmember group1 ... > no need to keep batch files. ...
    (microsoft.public.windows.server.scripting)