How to expanding environmental variables?

John Klehm xixsimplicityxix at gmail.com
Fri Jul 17 19:15:10 CDT 2009


On Fri, Jul 17, 2009 at 6:16 PM, Austin English<austinenglish at gmail.com> wrote:
> Howdy all,
>
> I'm working on a automated test for Photoshop CS 2. As before, I'm
> trying to do so in a portable way, so it works on various
> locales/windows versions (or as much as possible). Because of
> wine/windows differences, I need a portable way to get to the shared
> documents folder, e.g.,:
> Windows XP:
> C:\Documents and Settings\All Users\Shared Documents
> WIndows Vista:
> C:\users\Public\Public Documents
> Wine:
> C:\users\Public\Documents
>
> Windows has several variables for this sort of thing
> (http://msdn.microsoft.com/en-us/library/ms933062(WinEmbedded.5).aspx).
> In particular, I need a way to return what %16430% is on the target
> system. I've tried using cmd.exe to echo it, but it's not expanding
> it. Does anyone know how I can expand this type of variable? I figured
> there's probably something in shell32 that can accomplish this, but

Well hrmm cmd /c "echo %OS%"   works for me (prints Windows_NT)

but your example of %16430% doesnt expand so I assume that its only
available on Windows CE as the msdn link suggests. I am testing this
on vista.

I found these links:
SHGetKnownFolderPath
http://msdn.microsoft.com/en-us/library/bb762188(VS.85).aspx
with the list of known paths
http://msdn.microsoft.com/en-us/library/bb762584(VS.85).aspx

That list of known paths page shows  "Public Documents" is the display
name, you can actually access it as %PUBLIC%/Documents.  I also
verified that this is the case on vista by doing a "dir
C:\Users\Public\Documents" and checking that the folder I created in
"Public Documents" was listed there.

cmd -c "echo %PUBLIC%"  prints C:\Users\Public  for me on vista.

Hope this helps,
--John Klehm



More information about the wine-devel mailing list