Is it giving you any errors? Also what OS are you testing this on?
doing cd C:\Documents and Settings\%var%\Cookies works on XP Pro here at my office.
Also I just stumbled across something. Deltree is an outdated command and is not included with WinXP or 2k.
Instead if you just want to delete the files within the cookies folder, just use the del command. (Only downside would be if there's any folders within the Cookies folder).
Also, do you know if the variable is being set correctly? Try adding ECHO %var% under this line set /p var=Enter your User Name: