Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Scripting a login script for the possiblilty of different directories

Posted on 2007-04-03
4
Medium Priority
?
210 Views
Last Modified: 2010-04-16
Windows 2003 Server, Win 2000 and XP clients

I need to create a login script that silently uninstalls an antivirus program.
I already have the commands necessary to uninstall the program, however the program I need to uninstall may resides in one of two different directories depending on what version the user had at the time of install.
So the problem I have is how to write the script so that it works like this:

If this directory exists run this command
else run this other command

Thank you.
Jeremy Leigh
0
Comment
Question by:jvleigh221
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 96

Accepted Solution

by:
Lee W, MVP earned 2000 total points
ID: 18844656
In a batch file, this would be the line:

if exist "X:\path\to\directory" command
if exist "X:\path\to\other\directory" command
0
 
LVL 30

Expert Comment

by:LauraEHunterMVP
ID: 18844662
I don't have a 2000 machine to test on, but the "IF EXIST" batch command works on 2K3 & XP:

IF EXIST C:\Windows \\server1\uninstallfromwindows.exe
IF EXIST C:\Winnt \\server1\uninstallfromwinnt.exe
...etc.
0
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 18844680
It works in 2000 - and I believe NT4 as well.  Possibly even 9x.
0
 

Author Comment

by:jvleigh221
ID: 18844693
Thank you...That was exactly what I was looking for...much appreciation.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question