Windows 7 question

Ken Ray kray at sonsothunder.com
Sat May 29 09:50:58 EDT 2010


> Mark Schonewille (off forum) came up with the best answer (I think),
> not requiring a shell command.
> 
>        put item 1 of specialfolderpath("system") into xxxxx
> 
> and strip off the "/WINDOWS" text !
> 
> And this works for all Windows systems that I know.

Sorry for coming late to the party here, but there's a "gotcha" you need to
know about:

Although the specialFolderPath() approach will give you a path, you can't
count on "/WINDOWS" being in the path - you can give the main Windows
directory any name you like during the install of ANY version of Windows (so
far). However since most people don't install Windows but just get it
preloaded on PCs they purchase, it is almost always "WINDOWS".

For example, I used to have a PC which dual-booted Windows ME or Windows XP
(yes, this was a long time ago), and I had one directory named "WINDOWS" and
the other "WINXP", and based on the boot choice it would pick the proper
folder. So if I booted in XP and got the specialFolderPath("system"), it
returned "C:/WINXP".

So to truly make it work, you need to not assume anything other than the
specialFolderPath will give you a path that you can delete the last
"/"-delimited item from to get what *should* be (until Microsoft changes it)
the system volume:

set the itemDel to "/"
put item 1 to -2 of specialFolderPath("system") into tSysDrive

Just my 2 cents,


Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
 





More information about the Use-livecode mailing list