Problem with syntax in batch file
Hi all,
I'm having some trouble finding the error in the syntax for a batch file I wrote. Google was very little help, and I'm new to batch files, and scripting in general, so I apologize if this is wasting anyone's time.
The batch file is as follows:
**BEGIN BATCH**
@echo off
cls
echo.
echo.
echo This will install the Company Fonts.
echo.
echo.
echo if exists C:\Windows\Fonts\companyfonts*.ttf goto END
wscript "\\server\filepath\Fonts.vbs"
echo.
echo Fonts have been installed.
:END
The problem I'm running into has to do with the "IF" statement. The batch file should be checking to see if the company fonts are already on the computer, and if they are, it should terminate immediately.
Instead it's calling the vbscript anyway, and if the fonts are already installed, the users get a "Copy/Replace" prompt for each font the vbscript is calling.
Please, how can I configure this batch file to check for the fonts, and terminate itself without calling the vbscript if it detects them?
Answers (3)
remove the echo in front of the "if"
Comments:
-
https://www.google.com/search?q=bacth+file+if+statement&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a&channel=fflb - SMal.tmcc 10 years ago
Comments:
-
Please start another thread rather than hijacking this one - EdT 10 years ago
@echo off
cls
echo.
echo.
echo This will install the Company Fonts.
echo.
echo.
if exists C:\Windows\Fonts\companyfonts*.ttf goto END
wscript "\\server\filepath\Fonts.vbs"
echo.
echo Fonts have been installed.
:END
*Cough
echo if exists C:\Windows\Fonts\companyfonts*.ttf
if exists C:\Windows\Fonts\companyfonts*.ttf
(:
Please note this is not the best approach, there are some registry settings that need added with the fonts as well, but I cant see your VBS script so im hoping it covers that bit.