0

Here I am concatenating 2 variables to check whether a particular directory exists or not, i don't know what is missing here, pl help.

 set MyFolder=\\192.108.10.10\Backup    
    echo.
    for /f %%a in ('sqlcmd -S %SqlServer% -U %Username% -P %Password% -Q "SET NOCOUNT ON select ltrim(convert(date, getdate()))" -h -1') do set CurrentDate=%%a
    echo.    
echo %NetworkFolder2%\%CurrentDate%
    IF exist %MyFolder%\%CurrentDate%( echo yes ) ELSE ( echo no )
mandeep
  • 21
  • 1
  • 6
  • 1
    Possible duplicate of [How to check if directory exists in %PATH%?](https://stackoverflow.com/questions/141344/how-to-check-if-directory-exists-in-path) – aschipfl Mar 23 '18 at 10:02
  • 1
    You should check what your variables actually contain. Note that there is a space missing before the first `(` in your `if` command line. – aschipfl Mar 23 '18 at 10:03
  • my mistake.............. – mandeep Mar 23 '18 at 10:12
  • 1
    You're welcome! The quotation marks however do make sense (`if exist "D:\some\path\file name.ext" (echo yes) else (echo no)`)... – aschipfl Mar 23 '18 at 10:43

0 Answers0