Reputation: 430
I have written a bat file for users to download a svn repository and finally open that folder using the start command. Here is how the script looks like:
@echo off
echo.
echo. [ SVN Updater ]
set SVNURL=https://svn.test.com/test
set SOURCE=C:\Projects\
set SVN=C:\Program Files\TortoiseSVN\bin
echo.
"%SVN%\TortoiseProc.exe" /command:checkout /path:"%SOURCE%" /url:%SVNURL% /closeonend:2echo. done.
echo.
echo. Operation complete.
start C:\Projects\
This works fine if SVN is installed as it will checkout to the destination folder C:\Projects. But the problem is if Tortoise SVN is not installed in the user's machine. The operation will fail and return a message "Cannot open C:\Projects\" As the folder doesn't exist.
Question: I need to place an if condition or rescue if it couldn't open the local folder, and rather send a message like "Svn not installed". Can you please help me out with this. I am a ruby programmer and don't know much about batch scripting.
Thanks in advance
Upvotes: 0
Views: 550
Reputation: 41224
This will alert the user. What did you want to do?
if not exist "%SOURCE%\" (
echo Please install XXX program and try again
pause
goto :EOF
)
Upvotes: 1