os: what not to do when using environment variables...

let's say you want to set a value to foo. so, you do something like this:

C:\>set foo = geniusboy

(you probably already see the mistake i just made.) so, now you want to retrieve the variable to use somewhere. you try to get it back by using this:

C:\>echo %foo% 
%foo%


instead of getting back geniusboy, you get back %foo%. hmmm. where did it go? now you run this command just to list all the environment variables that start with f:

C:\>set f 
foo = geniusboy 
FP_NO_HOST_CHECK=NO

so alright, it looks like it took. why doesn't it come back with the first echo command? notice the spaces in the variable? try echoing %foo %.
C:\>echo %foo % 
geniusboy

even the value returned has a space. apparently, it is quite literal about those spaces. :) clear the value and try again (don't forget the space). now it works fine:
C:\>set foo = 
C:\>set foo=geniusboy 
C:\>echo %foo% 
geniusboy

Comments