Solved

Scripting a login script for the possiblilty of different directories

Posted on 2007-04-03
4
201 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
  • 2
4 Comments
 
LVL 95

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 95

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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
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 …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

707 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now