Zend certified PHP/Magento developer

Windows: How to save a variable -(input: path) to text file

I’m trying to save a variable to text file, but i’m failing:

:folder
 echo. && echo Where is your folder ?
 set /p userinputpath = Type input[Drive][Path]:
 echo "%userinputpath%" >> folder.txt   
 IF EXIST "%userinputpath%" (goto checkexe) REM goto check .exe
 echo Incorrect input & goto folder

Trying to save the userinputpath variable -> input looks like this: C:Program Files (x86)SubfolderSubfolder

If i change the variable to string, it’s working.
What is the problem ?