Ok. Try this out. It uses the win32 api to get info from the registry. It gets the Desktop path on mine accurately. Let me know if it works for you. I included a series of possible folder retrievals in the function itself if you set value$= to any of those names:
rem retrieve the location of various windows system folders
rem by latch
rem 7/15/2008
set window on
advapi32=1
load dll "advapi32.dll",advapi32
print get_system_path(advapi32,1,2,"Desktop")
end
function get_system_path(advapi32,mem1,mem2,value$)
remstart
possible strings for value$:
Administrative Tools
AppData
Cache
Cookies
Desktop
Favorites
Fonts
History
Local AppData
My Pictures
NetHood
Personal
PrintHood
Programs
Recent
SendTo
Start Menu
Startup
Templates
remend
temp$="Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
HKEY_CURRENT_USER = 2147483649
KEY_QUERY_VALUE = 1
KEY_ENUMERATE_SUB_KEYS = 8
make memblock mem1,4
ptr1=get memblock ptr(mem1)
make memblock mem2,12
ptr2=get memblock ptr(mem2)
call dll advapi32,"RegOpenKeyExA",HKEY_CURRENT_USER,temp$,0,KEY_QUERY_VALUE,ptr2
hkey=memblock dword(mem2,0)
`print hkey
path$=""
for n=1 to 255
path$=path$+chr$(65)
next n
write memblock dword mem1,0,255
call dll advapi32,"RegQueryValueExA",hkey,value$,0,0,path$,ptr1
`print path$
rem cleanup
delete memblock mem1
delete memblock mem2
endfunction path$
Enjoy your day.