Page 1 of 1

Environment variables not working under Vista

Posted: Mon Oct 29, 2007 10:52 am
by Chris Miller
I'm doing a check to verify that the ASP.NET 2.0 extension has been registered into IIS. I do this by checking for the existence of the folder
$WWWROOTDIR$aspnet_client\\system_web\\2_0_50727

$WWWROOTDIR$ was assigned from WWW->WWWRoot. This evaulates as %SystemDrive%\\inetpub\\wwwroot.

I then do the following code:
Replace %SystemDrive% with #SystemDrive# in variable WWWROOTDIR

On XP and 2003 the $SystemDrive# gets replaced with the actual system drive. On Vista it stays $SystemDrive# and the "Does Folder Exists" command fails. How can I get the variable to expand correctly under Vista?

thanks,
Chris Miller
VersaTrans Solutions, Inc

Posted: Tue Oct 30, 2007 5:14 am
by Gizm0
Sorry,

What' exactly is $SystemDrive# ? It was supposed to be $SystemDrive$ ? It can't be working on XP or 2003 but not on Vista, because that specific command has nothing to do with the OS. It's a simple String Replace command.

Posted: Tue Oct 30, 2007 10:20 am
by Chris Miller
That was a typo in my message posting. It should have read

Replace %SystemDrive% with #SystemDrive# in variable WWWROOTDIR

I was given that syntax in another thread.

After the Replace command executes, if I display that value ($WWWROOTDIR$) with the MessageBox command I get the correct value in XP and 2003 and the wrong value in Vista

XP/2003 displays c:\\inetpub\\wwwroot
Vista displays #SystemDrive#\\inetpub\\wwwroot

I can easily reproduce this problem in a new project that pretty much does notning but do the variable replacement and then displays the variable. I can attach the .mia/.mpr files in another message if that would help.