Question Locked

Help with the ""if exist"" part for script

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi everyone, Ive tried the if exist for my script that will 1st check if the viewers are installed and then install if not present, but even though the viewers are installed, the setup process starts in anycase. Can someone pls help me. Here is what ive done. Thnx

:WordViewer
if exist C:\Program Files\Microsoft Office\OFFICE11\WORDVIEW.exe goto:ExelViewer
\\172.21.96.13\Updates\SoftwareInstall\wdviewer /q
:ExelViewer
\\172.21.96.13\Updates\SoftwareInstall\xlviewer /q

:PowerPointViewer2007
if exist C:\Program Files\Microsoft Office\Office12\PPTVIEW.exe goto:AcrobatReader 8
\\172.21.96.13\Updates\SoftwareInstall\powerpointviewer /quiet

:AcrobatReader 8
if exist C:\Documents and Settings\All Users\Start Menu\Programs\AcroRd32.exe GOTO:end
\\172.21.96.13\Updates\SoftwareInstall\AdbeRdr80_en_US /sAll

3 replies

by bizzo

Because you have spaces in your filename, it will fail, they need to be "quoted" e.g.

:WordViewer
if exist "C:\Program Files\Microsoft Office\OFFICE11\WORDVIEW.exe" goto:ExelViewer
\\172.21.96.13\Updates\SoftwareInstall\wdviewer /q
:ExelViewer
\\172.21.96.13\Updates\SoftwareInstall\xlviewer /q

:PowerPointViewer2007
if exist "C:\Program Files\Microsoft Office\Office12\PPTVIEW.exe" goto:AcrobatReader 8
\\172.21.96.13\Updates\SoftwareInstall\powerpointviewer /quiet

:AcrobatReader 8
if exist "C:\Documents and Settings\All Users\Start Menu\Programs\AcroRd32.exe" GOTO:end
\\172.21.96.13\Updates\SoftwareInstall\AdbeRdr80_en_US /sAll

This discussion is closed to new replies.