I've come across a weird issue on Windows 10 with Batch Scripts.
This code reads in a file called manifest.yaml and compares its content to another file.
set EXECUTABLE_DIR=C:\some\path
set version=qqq
set /p oldversion=<%EXECUTABLE_DIR%\%version%\manifest.yaml
echo "%oldversion%"
set /p newversion=<%EXECUTABLE_DIR%\%version%\tmp\manifest.yaml
if "%oldversion%"=="%newversion%" (
   echo "equal"
) else (
   echo "not equal"
)
This code works on its own. But if I include this into a larger batch script, the oldversion and newversion variables are empty and I cannot find reasons why.
Things I have double checked:
- both files exist and do have content
- both files are not blocked for reading (no other program is currently writing those files)
- oldversionand- newversionare both never used or overwritten somewhere else
- EXECUTABLE_DIRand- versionboth contain the correct path to the file
- the short script does infact work with the original file locations the large file would use
This code is included in the larger batch script inside an if block like this:
IF exist %EXECUTABLE_DIR%\%version%\ (
  REM Code goes here
)
 
    