How to expanding environmental variables?
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 nothing popped up at me immediately (and I'm about to run, so I wanted to e-mail before I leave). Surely there's an easy way and I'm just overlooking it... Thanks! -- -Austin
On Fri, Jul 17, 2009 at 6:16 PM, Austin English<austinenglish(a)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
On Fri, Jul 17, 2009 at 7:15 PM, John Klehm<xixsimplicityxix(a)gmail.com> wrote:
On Fri, Jul 17, 2009 at 6:16 PM, Austin English<austinenglish(a)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
Oops I guess SHGetFolderPath is more portable (win95 and up) http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx list of predefines, CSIDL http://msdn.microsoft.com/en-us/library/bb762494(VS.85).aspx Cheers, --John
On Fri, Jul 17, 2009 at 07:27:11PM -0500, John Klehm wrote:
Oops I guess SHGetFolderPath is more portable (win95 and up)
It is just a pain getting the right include file and library, especially on win2k with oldish versions of visual C. David -- David Laight: david(a)l8s.co.uk
2009/7/18 Austin English <austinenglish(a)gmail.com>:
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 nothing popped up at me immediately (and I'm about to run, so I wanted to e-mail before I leave). Surely there's an easy way and I'm just overlooking it...
Thanks! -- -Austin
On a French XP SP3 explorer sees this folder as "C:\Documents and Settings\All Users\Documents Partagés" but it points in fact to "C:\Documents and Settings\All Users\Documents", and under cmd only the second one is accessible. On 2K there's no linking at all, it's "C:\Documents and Settings\All Users\Documents" on both sides. If you have access to the registry, the full path of this folder is contained (at least on 2K and XP) in the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Common Documents -- Nicolas Le Cam
On Fri, Jul 17, 2009 at 7:22 PM, Nicolas Le Cam<niko.lecam(a)gmail.com> wrote:
2009/7/18 Austin English <austinenglish(a)gmail.com>:
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 nothing popped up at me immediately (and I'm about to run, so I wanted to e-mail before I leave). Surely there's an easy way and I'm just overlooking it...
Thanks! -- -Austin
On a French XP SP3 explorer sees this folder as "C:\Documents and Settings\All Users\Documents Partagés" but it points in fact to "C:\Documents and Settings\All Users\Documents", and under cmd only the second one is accessible. On 2K there's no linking at all, it's "C:\Documents and Settings\All Users\Documents" on both sides.
If you have access to the registry, the full path of this folder is contained (at least on 2K and XP) in the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Common Documents
This may be the way to go, thanks! -- -Austin
On Sat, Jul 18, 2009 at 06:16, Austin English<austinenglish(a)gmail.com> wrote:
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
In Windows, the proper portable way is to #include <shlobj.h>, link to shell32.lib and call SHGetFolderPath for CSIDL_COMMON_DOCUMENTS. Works on Windows 9x with IE5 installed, and on all NT-family systems. It also seems to be implemented in current Wine. http://msdn.microsoft.com/en-us/library/bb762181%28VS.85%29.aspx
On Mon, Jul 20, 2009 at 2:08 AM, Yuri Khan<yurivkhan(a)gmail.com> wrote:
On Sat, Jul 18, 2009 at 06:16, Austin English<austinenglish(a)gmail.com> wrote:
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
In Windows, the proper portable way is to #include <shlobj.h>, link to shell32.lib and call SHGetFolderPath for CSIDL_COMMON_DOCUMENTS. Works on Windows 9x with IE5 installed, and on all NT-family systems. It also seems to be implemented in current Wine.
http://msdn.microsoft.com/en-us/library/bb762181%28VS.85%29.aspx
Sounds like you'd want a small helper binary to do this.
participants (6)
-
Austin English -
David Laight -
John Klehm -
Lei Zhang -
Nicolas Le Cam -
Yuri Khan