This is not a tutorial, but a question in need of an answer.

I am creating a batch file for creating user names and passwords for an apache website. If you are familar with apache then you know about the password utility that ecrypts the password part of the file.

Anyways, My problem is that before creating/adding the new user the batch file checks for to original file that is on a network folder. I will be add source code but be warned that it is real messy. I havent cleaned it up yet.

@ECHO on
title Create Password Utility
CLS

:Check1
REM Check for Primary User file
pause
IF EXIST \\yada\drive (d)\yada\Restricted\usr\yada\passwords goto copylocal
IF NOT EXIST \\yada\drive (d)\yada\Restricted\usr\yada\passwords GOTO username

:copylocal
REM Copy passwords file from server
copy \\yada\drive (d)\yada\Restricted\usr\yada\passwords passwords
REM Above here note that i didnt specify the location for the copied passwords because
REM This batch file may move am i want the copy in the same folder as it



pause

:username
ECHO/
ECHO/
ECHO/
:: SET /P prompts for input and sets the variable
:: to whatever the user types
SET Choice=
SET /P username=Type User name To be created:
:: The syntax in the next line extracts the substring
:: starting at 0 (the beginning) and 1 character long
IF NOT '%username%'=='' SET Choice=%Choice:~0,1%
ECHO.
ECHO "%username%" is The user namer.
ECHO.
GOTO password
assword
ECHO/
ECHO/
ECHO/
:: SET /P prompts for input and sets the variable
:: to whatever the user types
SET Choice=
SET /P password=Type password To be created:
:: The syntax in the next line extracts the substring
:: starting at 0 (the beginning) and 1 character long
IF NOT '%password%'=='' SET Choice=%Choice:~0,1%
ECHO.
ECHO "%password%" is The user namer.
ECHO.
GOTO display
ECHO
ECHO
ECHO
ECHO
:display
CLS
ECHO/
ECHO/
ECHO/
ECHO File Name: passwd.txt
ECHO File Name: %username%
ECHO File Name: %password%
Pause
IF EXIST H:\work\websites\passwords GOTO addtofile
IF NOT EXIST H:\work\websites\passwords GOTO createfile

:createfile
CLS
echo Creating password files passwords & passwd.txt
echo/
echo please wait.


rem Creates two password files
htpasswd.exe -bc passwords %username% %password%
htpasswd.exe -bcp passwd.txt %username% %password%
xcopy passwords \\yada\drive (d)\yada\Restricted\usr\yada\passwords


echo/
echo/
echo Remember to add users to the members list.
pause
edit "\\yada\drive (d)\yada\Restricted\usr\yada\groups"
pause
goto end

:addtofile
CLS
echo Creating password file passwd.txt
echo/
echo please wait.

rem Creates two password files
htpasswd.exe -b passwords %username% %password%
htpasswd.exe -bp passwd.txt %username% %password%
xcopy passwords \\yada\drive (d)\yada\Restricted\usr\yada\passwords

echo/
echo/
echo Remember to add users to the members list.
pause
edit "\\yada\drive (d)\yada\Restricted\usr\yada\groups"
:End
CLS



Also note that i am creating a local file for backup and later editing/viewing
Anyways the problem is with " If exist " it does not want to take my network address. it works fine if i run/open a file but it wont work with " if exist ".
Any help would be appreciated!