To do this in BASH is simple:

```
#!/bin/sh
echo "3" > text.file
foo=$(<text.file)
if [ $foo -eq 3 ]; then
echo "bar"
fi

```

Returns `bar`.

Windows, however, will not cooperate.

```
> ECHO "3" > test.file

> SET /p foo= < test.file

> ECHO %foo%
"3"

> IF %foo% equ 3 ECHO bar

> IF NOT %foo% equ 3 ECHO bar
bar

```

I am mystified, and I really need to get this to work. I hope I haven't done something really dumb and elementary, but I fear I have.