Solved

Scripting a login script for the possiblilty of different directories

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
The viewer will learn how to count occurrences of each item in an array.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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