Re: scripting vs. batch files?
- From: "David H. Lipman" <DLipman~nospam~@Verizon.Net>
- Date: Mon, 22 Aug 2005 12:53:16 -0400
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
.
- Follow-Ups:
- Re: scripting vs. batch files?
- From: Corné Bogaarts
- Re: scripting vs. batch files?
- References:
- scripting vs. batch files?
- From: Linn Kubler
- scripting vs. batch files?
- Prev by Date: scripting vs. batch files?
- Next by Date: RE: What's \\hostname\IPC$ for?
- Previous by thread: scripting vs. batch files?
- Next by thread: Re: scripting vs. batch files?
- Index(es):
Relevant Pages
|