if else

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
jmiller1225
Posts: 1
Joined: 08 Jul 2014 19:18

if else

#1 Post by jmiller1225 » 08 Jul 2014 19:30

I'm trying to write a script if a program isn't there then it would install the program. If the program is there it would open it up.. The problem I'm having is understanding the i f else statements

If c:/program/ABC.exe c:/program/ABC.exe
ELSE ABCinstall.exe

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: if else

#2 Post by foxidrive » 08 Jul 2014 23:54

Code: Select all

@echo off
if exist "c:\folder\file.exe" (
     start "" "c:\folder\file.exe"
 ) else (
     echo run installer
)

Post Reply