Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 12258
  • Last Modified:

login script and batch file

I would like my login sript to execute a batch file for Windows 2000 and XP users only..

Here is an example of my current login script:

--------

@echo off


Echo off

\\svfile\tnsnames\updatetnsnamesoapps.bat

if #%OS%#==## goto WIN95
if %OS%==Windows_NT GOTO NT

:WIN95
net use H: /home



if exist p:\nt.txt goto END
if exist p:\ net use /d p:
net use p: /delete
net use q: /delete
net use x: /delete
net use p: \\svfile\PUBLICwest
net use q: \\svfile\eastinterconnect
net use x: \\svfile\common
goto END

:NT
if %windir%==C:\WTSRV goto END


if exist p:\nt.txt goto END
if exist p:\ net use /d p:
net use p: /delete
net use q: /delete
net use r: /delete
net use x: /delete
net use p: \\svfile\PUBLICwest
net use q: \\svfile\eastinterconnect
net use x: \\svfile\common
net time \\s_nw_sms /set /y

:END

---

I want to add a new statement for \\svfile\ittools\install.bat for ONLY 2000 and XP users... how can this be done?

thanks
0
Justin Durrant
Asked:
Justin Durrant
  • 2
1 Solution
 
kemp_aCommented:
A quick way is to dump the output from VER into a file & check for specific versions:


VER >h:\winver.tmp
findstr /B /I XP h:\winver.tmp>nul
IF %ERRORLEVEL%==1 GOTO NotXP
REM DO YOUR XP STUFF HERE
GOTO OSSPECIFICCompleted
:NotXP
findstr /B /I 2000 h:\winver.tmp>nul
IF %ERRORLEVEL%==1 GOTO OSSPECIFICCompleted
REM DO YOUR 2000 STUFF HERE
:OSSPECIFICCompleted

Cheers
0
 
kemp_aCommented:
Oh, found a quicker way as outlined here http://www.experts-exchange.com/Operating_Systems/Win2000/Q_20740515.html

VER | Find /C "XP">NUL
IF %ERRORLEVEL%==1 goto NotXP

:NotXP
VER | Find /C "2000">NUL
IF %ERRORLEVEL%==1 goto Not2K

:Not2K

Hope that helps
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now