In tip 256, we switched to the "Windows" directory before exiting the script. If that doesn't work, or is intermitant, try the following at the end of the script:

if %OS% == Windows_NT goto WNT
if exist c:\windows\*.* goto W3
if exist c:\win95\*.* goto W95
if exist c:\win98\*.* goto W98
REM you can add any other directories that you use
goto end
cd %SystemRoot%
goto end
cd c:\windows
if exist c:\windows\lmscript.$$$ goto end
goto lms
cd c:\win95
if exist c:\win95\lmscript.$$$ goto end
goto lms
cd c:\win98
if exist c:\win98\lmscript.$$$ goto end
echo . > lmscript.$$$