Solved

Scripting a login script for the possiblilty of different directories

Posted on 2007-04-03
4
208 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 500 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
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…

739 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